In [2]:
import pandas as pdbtc = pd.read_csv("data/coin_Bitcoin.csv")
In [3]:
btc
Out[3]:
SNo | Name | Symbol | Date | High | Low | Open | Close | Volume | Marketcap | |
0 | 1 | Bitcoin | BTC | 2013-04-29 23:59:59 | 147.488007 | 134.000000 | 134.444000 | 144.539993 | 0.000000e+00 | 1.603769e+09 |
1 | 2 | Bitcoin | BTC | 2013-04-30 23:59:59 | 146.929993 | 134.050003 | 144.000000 | 139.000000 | 0.000000e+00 | 1.542813e+09 |
2 | 3 | Bitcoin | BTC | 2013-05-01 23:59:59 | 139.889999 | 107.720001 | 139.000000 | 116.989998 | 0.000000e+00 | 1.298955e+09 |
3 | 4 | Bitcoin | BTC | 2013-05-02 23:59:59 | 125.599998 | 92.281898 | 116.379997 | 105.209999 | 0.000000e+00 | 1.168517e+09 |
4 | 5 | Bitcoin | BTC | 2013-05-03 23:59:59 | 108.127998 | 79.099998 | 106.250000 | 97.750000 | 0.000000e+00 | 1.085995e+09 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
2986 | 2987 | Bitcoin | BTC | 2021-07-02 23:59:59 | 33939.588699 | 32770.680780 | 33549.600177 | 33897.048590 | 3.872897e+10 | 6.354508e+11 |
2987 | 2988 | Bitcoin | BTC | 2021-07-03 23:59:59 | 34909.259899 | 33402.696536 | 33854.421362 | 34668.548402 | 2.438396e+10 | 6.499397e+11 |
2988 | 2989 | Bitcoin | BTC | 2021-07-04 23:59:59 | 35937.567147 | 34396.477458 | 34665.564866 | 35287.779766 | 2.492431e+10 | 6.615748e+11 |
2989 | 2990 | Bitcoin | BTC | 2021-07-05 23:59:59 | 35284.344430 | 33213.661034 | 35284.344430 | 33746.002456 | 2.672155e+10 | 6.326962e+11 |
2990 | 2991 | Bitcoin | BTC | 2021-07-06 23:59:59 | 35038.536363 | 33599.916169 | 33723.509655 | 34235.193451 | 2.650126e+10 | 6.418992e+11 |
2991 rows × 10 columns
In [4]:
btc.set_index("Date")
Out[4]:
SNo | Name | Symbol | High | Low | Open | Close | Volume | Marketcap | |
Date | |||||||||
2013-04-29 23:59:59 | 1 | Bitcoin | BTC | 147.488007 | 134.000000 | 134.444000 | 144.539993 | 0.000000e+00 | 1.603769e+09 |
2013-04-30 23:59:59 | 2 | Bitcoin | BTC | 146.929993 | 134.050003 | 144.000000 | 139.000000 | 0.000000e+00 | 1.542813e+09 |
2013-05-01 23:59:59 | 3 | Bitcoin | BTC | 139.889999 | 107.720001 | 139.000000 | 116.989998 | 0.000000e+00 | 1.298955e+09 |
2013-05-02 23:59:59 | 4 | Bitcoin | BTC | 125.599998 | 92.281898 | 116.379997 | 105.209999 | 0.000000e+00 | 1.168517e+09 |
2013-05-03 23:59:59 | 5 | Bitcoin | BTC | 108.127998 | 79.099998 | 106.250000 | 97.750000 | 0.000000e+00 | 1.085995e+09 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
2021-07-02 23:59:59 | 2987 | Bitcoin | BTC | 33939.588699 | 32770.680780 | 33549.600177 | 33897.048590 | 3.872897e+10 | 6.354508e+11 |
2021-07-03 23:59:59 | 2988 | Bitcoin | BTC | 34909.259899 | 33402.696536 | 33854.421362 | 34668.548402 | 2.438396e+10 | 6.499397e+11 |
2021-07-04 23:59:59 | 2989 | Bitcoin | BTC | 35937.567147 | 34396.477458 | 34665.564866 | 35287.779766 | 2.492431e+10 | 6.615748e+11 |
2021-07-05 23:59:59 | 2990 | Bitcoin | BTC | 35284.344430 | 33213.661034 | 35284.344430 | 33746.002456 | 2.672155e+10 | 6.326962e+11 |
2021-07-06 23:59:59 | 2991 | Bitcoin | BTC | 35038.536363 | 33599.916169 | 33723.509655 | 34235.193451 | 2.650126e+10 | 6.418992e+11 |
2991 rows × 9 columns
In [5]:
btc
Out[5]:
SNo | Name | Symbol | Date | High | Low | Open | Close | Volume | Marketcap | |
0 | 1 | Bitcoin | BTC | 2013-04-29 23:59:59 | 147.488007 | 134.000000 | 134.444000 | 144.539993 | 0.000000e+00 | 1.603769e+09 |
1 | 2 | Bitcoin | BTC | 2013-04-30 23:59:59 | 146.929993 | 134.050003 | 144.000000 | 139.000000 | 0.000000e+00 | 1.542813e+09 |
2 | 3 | Bitcoin | BTC | 2013-05-01 23:59:59 | 139.889999 | 107.720001 | 139.000000 | 116.989998 | 0.000000e+00 | 1.298955e+09 |
3 | 4 | Bitcoin | BTC | 2013-05-02 23:59:59 | 125.599998 | 92.281898 | 116.379997 | 105.209999 | 0.000000e+00 | 1.168517e+09 |
4 | 5 | Bitcoin | BTC | 2013-05-03 23:59:59 | 108.127998 | 79.099998 | 106.250000 | 97.750000 | 0.000000e+00 | 1.085995e+09 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
2986 | 2987 | Bitcoin | BTC | 2021-07-02 23:59:59 | 33939.588699 | 32770.680780 | 33549.600177 | 33897.048590 | 3.872897e+10 | 6.354508e+11 |
2987 | 2988 | Bitcoin | BTC | 2021-07-03 23:59:59 | 34909.259899 | 33402.696536 | 33854.421362 | 34668.548402 | 2.438396e+10 | 6.499397e+11 |
2988 | 2989 | Bitcoin | BTC | 2021-07-04 23:59:59 | 35937.567147 | 34396.477458 | 34665.564866 | 35287.779766 | 2.492431e+10 | 6.615748e+11 |
2989 | 2990 | Bitcoin | BTC | 2021-07-05 23:59:59 | 35284.344430 | 33213.661034 | 35284.344430 | 33746.002456 | 2.672155e+10 | 6.326962e+11 |
2990 | 2991 | Bitcoin | BTC | 2021-07-06 23:59:59 | 35038.536363 | 33599.916169 | 33723.509655 | 34235.193451 | 2.650126e+10 | 6.418992e+11 |
2991 rows × 10 columns
In [6]:
btc.set_index("Date", inplace=True)
In [7]:
btc
Out[7]:
SNo | Name | Symbol | High | Low | Open | Close | Volume | Marketcap | |
Date | |||||||||
2013-04-29 23:59:59 | 1 | Bitcoin | BTC | 147.488007 | 134.000000 | 134.444000 | 144.539993 | 0.000000e+00 | 1.603769e+09 |
2013-04-30 23:59:59 | 2 | Bitcoin | BTC | 146.929993 | 134.050003 | 144.000000 | 139.000000 | 0.000000e+00 | 1.542813e+09 |
2013-05-01 23:59:59 | 3 | Bitcoin | BTC | 139.889999 | 107.720001 | 139.000000 | 116.989998 | 0.000000e+00 | 1.298955e+09 |
2013-05-02 23:59:59 | 4 | Bitcoin | BTC | 125.599998 | 92.281898 | 116.379997 | 105.209999 | 0.000000e+00 | 1.168517e+09 |
2013-05-03 23:59:59 | 5 | Bitcoin | BTC | 108.127998 | 79.099998 | 106.250000 | 97.750000 | 0.000000e+00 | 1.085995e+09 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
2021-07-02 23:59:59 | 2987 | Bitcoin | BTC | 33939.588699 | 32770.680780 | 33549.600177 | 33897.048590 | 3.872897e+10 | 6.354508e+11 |
2021-07-03 23:59:59 | 2988 | Bitcoin | BTC | 34909.259899 | 33402.696536 | 33854.421362 | 34668.548402 | 2.438396e+10 | 6.499397e+11 |
2021-07-04 23:59:59 | 2989 | Bitcoin | BTC | 35937.567147 | 34396.477458 | 34665.564866 | 35287.779766 | 2.492431e+10 | 6.615748e+11 |
2021-07-05 23:59:59 | 2990 | Bitcoin | BTC | 35284.344430 | 33213.661034 | 35284.344430 | 33746.002456 | 2.672155e+10 | 6.326962e+11 |
2021-07-06 23:59:59 | 2991 | Bitcoin | BTC | 35038.536363 | 33599.916169 | 33723.509655 | 34235.193451 | 2.650126e+10 | 6.418992e+11 |
2991 rows × 9 columns
In [8]:
btc.index
Out[8]:
Index(['2013-04-29 23:59:59', '2013-04-30 23:59:59', '2013-05-01 23:59:59',
'2013-05-02 23:59:59', '2013-05-03 23:59:59', '2013-05-04 23:59:59',
'2013-05-05 23:59:59', '2013-05-06 23:59:59', '2013-05-07 23:59:59',
'2013-05-08 23:59:59',
...
'2021-06-27 23:59:59', '2021-06-28 23:59:59', '2021-06-29 23:59:59',
'2021-06-30 23:59:59', '2021-07-01 23:59:59', '2021-07-02 23:59:59',
'2021-07-03 23:59:59', '2021-07-04 23:59:59', '2021-07-05 23:59:59',
'2021-07-06 23:59:59'],
dtype='object', name='Date', length=2991)
In [9]:
btc.High
Out[9]:
Date
2013-04-29 23:59:59 147.488007
2013-04-30 23:59:59 146.929993
2013-05-01 23:59:59 139.889999
2013-05-02 23:59:59 125.599998
2013-05-03 23:59:59 108.127998
...
2021-07-02 23:59:59 33939.588699
2021-07-03 23:59:59 34909.259899
2021-07-04 23:59:59 35937.567147
2021-07-05 23:59:59 35284.344430
2021-07-06 23:59:59 35038.536363
Name: High, Length: 2991, dtype: float64
In [10]:
btc.High.plot()
Out[10]:
<AxesSubplot:xlabel='Date'>

In [11]:
btc = pd.read_csv("data/coin_Bitcoin.csv")btc.High.plot()
Out[11]:
<AxesSubplot:>

In [12]:
countries = pd.read_csv("data/world-happiness-report-2021.csv")
In [73]:
countries["Healthy life expectancy"]
Out[73]:
Country name
Afghanistan 52.493
Albania 68.999
Algeria 66.005
Argentina 69.000
Armenia 67.055
...
Venezuela 66.700
Vietnam 68.034
Yemen 57.122
Zambia 55.809
Zimbabwe 56.201
Name: Healthy life expectancy, Length: 149, dtype: float64
In [14]:
countries
Out[14]:
Country name | Regional indicator | Ladder score | Standard error of ladder score | upperwhisker | lowerwhisker | Logged GDP per capita | Social support | Healthy life expectancy | Freedom to make life choices | Generosity | Perceptions of corruption | Ladder score in Dystopia | Explained by: Log GDP per capita | Explained by: Social support | Explained by: Healthy life expectancy | Explained by: Freedom to make life choices | Explained by: Generosity | Explained by: Perceptions of corruption | Dystopia + residual | |
0 | Finland | Western Europe | 7.842 | 0.032 | 7.904 | 7.780 | 10.775 | 0.954 | 72.000 | 0.949 | -0.098 | 0.186 | 2.43 | 1.446 | 1.106 | 0.741 | 0.691 | 0.124 | 0.481 | 3.253 |
1 | Denmark | Western Europe | 7.620 | 0.035 | 7.687 | 7.552 | 10.933 | 0.954 | 72.700 | 0.946 | 0.030 | 0.179 | 2.43 | 1.502 | 1.108 | 0.763 | 0.686 | 0.208 | 0.485 | 2.868 |
2 | Switzerland | Western Europe | 7.571 | 0.036 | 7.643 | 7.500 | 11.117 | 0.942 | 74.400 | 0.919 | 0.025 | 0.292 | 2.43 | 1.566 | 1.079 | 0.816 | 0.653 | 0.204 | 0.413 | 2.839 |
3 | Iceland | Western Europe | 7.554 | 0.059 | 7.670 | 7.438 | 10.878 | 0.983 | 73.000 | 0.955 | 0.160 | 0.673 | 2.43 | 1.482 | 1.172 | 0.772 | 0.698 | 0.293 | 0.170 | 2.967 |
4 | Netherlands | Western Europe | 7.464 | 0.027 | 7.518 | 7.410 | 10.932 | 0.942 | 72.400 | 0.913 | 0.175 | 0.338 | 2.43 | 1.501 | 1.079 | 0.753 | 0.647 | 0.302 | 0.384 | 2.798 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
144 | Lesotho | Sub-Saharan Africa | 3.512 | 0.120 | 3.748 | 3.276 | 7.926 | 0.787 | 48.700 | 0.715 | -0.131 | 0.915 | 2.43 | 0.451 | 0.731 | 0.007 | 0.405 | 0.103 | 0.015 | 1.800 |
145 | Botswana | Sub-Saharan Africa | 3.467 | 0.074 | 3.611 | 3.322 | 9.782 | 0.784 | 59.269 | 0.824 | -0.246 | 0.801 | 2.43 | 1.099 | 0.724 | 0.340 | 0.539 | 0.027 | 0.088 | 0.648 |
146 | Rwanda | Sub-Saharan Africa | 3.415 | 0.068 | 3.548 | 3.282 | 7.676 | 0.552 | 61.400 | 0.897 | 0.061 | 0.167 | 2.43 | 0.364 | 0.202 | 0.407 | 0.627 | 0.227 | 0.493 | 1.095 |
147 | Zimbabwe | Sub-Saharan Africa | 3.145 | 0.058 | 3.259 | 3.030 | 7.943 | 0.750 | 56.201 | 0.677 | -0.047 | 0.821 | 2.43 | 0.457 | 0.649 | 0.243 | 0.359 | 0.157 | 0.075 | 1.205 |
148 | Afghanistan | South Asia | 2.523 | 0.038 | 2.596 | 2.449 | 7.695 | 0.463 | 52.493 | 0.382 | -0.102 | 0.924 | 2.43 | 0.370 | 0.000 | 0.126 | 0.000 | 0.122 | 0.010 | 1.895 |
149 rows × 20 columns
In [15]:
countries.set_index("Country name", inplace=True)
In [16]:
countries
Out[16]:
Regional indicator | Ladder score | Standard error of ladder score | upperwhisker | lowerwhisker | Logged GDP per capita | Social support | Healthy life expectancy | Freedom to make life choices | Generosity | Perceptions of corruption | Ladder score in Dystopia | Explained by: Log GDP per capita | Explained by: Social support | Explained by: Healthy life expectancy | Explained by: Freedom to make life choices | Explained by: Generosity | Explained by: Perceptions of corruption | Dystopia + residual | |
Country name | |||||||||||||||||||
Finland | Western Europe | 7.842 | 0.032 | 7.904 | 7.780 | 10.775 | 0.954 | 72.000 | 0.949 | -0.098 | 0.186 | 2.43 | 1.446 | 1.106 | 0.741 | 0.691 | 0.124 | 0.481 | 3.253 |
Denmark | Western Europe | 7.620 | 0.035 | 7.687 | 7.552 | 10.933 | 0.954 | 72.700 | 0.946 | 0.030 | 0.179 | 2.43 | 1.502 | 1.108 | 0.763 | 0.686 | 0.208 | 0.485 | 2.868 |
Switzerland | Western Europe | 7.571 | 0.036 | 7.643 | 7.500 | 11.117 | 0.942 | 74.400 | 0.919 | 0.025 | 0.292 | 2.43 | 1.566 | 1.079 | 0.816 | 0.653 | 0.204 | 0.413 | 2.839 |
Iceland | Western Europe | 7.554 | 0.059 | 7.670 | 7.438 | 10.878 | 0.983 | 73.000 | 0.955 | 0.160 | 0.673 | 2.43 | 1.482 | 1.172 | 0.772 | 0.698 | 0.293 | 0.170 | 2.967 |
Netherlands | Western Europe | 7.464 | 0.027 | 7.518 | 7.410 | 10.932 | 0.942 | 72.400 | 0.913 | 0.175 | 0.338 | 2.43 | 1.501 | 1.079 | 0.753 | 0.647 | 0.302 | 0.384 | 2.798 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
Lesotho | Sub-Saharan Africa | 3.512 | 0.120 | 3.748 | 3.276 | 7.926 | 0.787 | 48.700 | 0.715 | -0.131 | 0.915 | 2.43 | 0.451 | 0.731 | 0.007 | 0.405 | 0.103 | 0.015 | 1.800 |
Botswana | Sub-Saharan Africa | 3.467 | 0.074 | 3.611 | 3.322 | 9.782 | 0.784 | 59.269 | 0.824 | -0.246 | 0.801 | 2.43 | 1.099 | 0.724 | 0.340 | 0.539 | 0.027 | 0.088 | 0.648 |
Rwanda | Sub-Saharan Africa | 3.415 | 0.068 | 3.548 | 3.282 | 7.676 | 0.552 | 61.400 | 0.897 | 0.061 | 0.167 | 2.43 | 0.364 | 0.202 | 0.407 | 0.627 | 0.227 | 0.493 | 1.095 |
Zimbabwe | Sub-Saharan Africa | 3.145 | 0.058 | 3.259 | 3.030 | 7.943 | 0.750 | 56.201 | 0.677 | -0.047 | 0.821 | 2.43 | 0.457 | 0.649 | 0.243 | 0.359 | 0.157 | 0.075 | 1.205 |
Afghanistan | South Asia | 2.523 | 0.038 | 2.596 | 2.449 | 7.695 | 0.463 | 52.493 | 0.382 | -0.102 | 0.924 | 2.43 | 0.370 | 0.000 | 0.126 | 0.000 | 0.122 | 0.010 | 1.895 |
149 rows × 19 columns
In [17]:
countries["Healthy life expectancy"]
Out[17]:
Country name
Finland 72.000
Denmark 72.700
Switzerland 74.400
Iceland 73.000
Netherlands 72.400
...
Lesotho 48.700
Botswana 59.269
Rwanda 61.400
Zimbabwe 56.201
Afghanistan 52.493
Name: Healthy life expectancy, Length: 149, dtype: float64
In [18]:
countries["Healthy life expectancy"].head(5).plot()
Out[18]:
<AxesSubplot:xlabel='Country name'>

In [19]:
df = pd.read_csv("data/world-happiness-report-2021.csv", index_col=0)
In [20]:
df
Out[20]:
Regional indicator | Ladder score | Standard error of ladder score | upperwhisker | lowerwhisker | Logged GDP per capita | Social support | Healthy life expectancy | Freedom to make life choices | Generosity | Perceptions of corruption | Ladder score in Dystopia | Explained by: Log GDP per capita | Explained by: Social support | Explained by: Healthy life expectancy | Explained by: Freedom to make life choices | Explained by: Generosity | Explained by: Perceptions of corruption | Dystopia + residual | |
Country name | |||||||||||||||||||
Finland | Western Europe | 7.842 | 0.032 | 7.904 | 7.780 | 10.775 | 0.954 | 72.000 | 0.949 | -0.098 | 0.186 | 2.43 | 1.446 | 1.106 | 0.741 | 0.691 | 0.124 | 0.481 | 3.253 |
Denmark | Western Europe | 7.620 | 0.035 | 7.687 | 7.552 | 10.933 | 0.954 | 72.700 | 0.946 | 0.030 | 0.179 | 2.43 | 1.502 | 1.108 | 0.763 | 0.686 | 0.208 | 0.485 | 2.868 |
Switzerland | Western Europe | 7.571 | 0.036 | 7.643 | 7.500 | 11.117 | 0.942 | 74.400 | 0.919 | 0.025 | 0.292 | 2.43 | 1.566 | 1.079 | 0.816 | 0.653 | 0.204 | 0.413 | 2.839 |
Iceland | Western Europe | 7.554 | 0.059 | 7.670 | 7.438 | 10.878 | 0.983 | 73.000 | 0.955 | 0.160 | 0.673 | 2.43 | 1.482 | 1.172 | 0.772 | 0.698 | 0.293 | 0.170 | 2.967 |
Netherlands | Western Europe | 7.464 | 0.027 | 7.518 | 7.410 | 10.932 | 0.942 | 72.400 | 0.913 | 0.175 | 0.338 | 2.43 | 1.501 | 1.079 | 0.753 | 0.647 | 0.302 | 0.384 | 2.798 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
Lesotho | Sub-Saharan Africa | 3.512 | 0.120 | 3.748 | 3.276 | 7.926 | 0.787 | 48.700 | 0.715 | -0.131 | 0.915 | 2.43 | 0.451 | 0.731 | 0.007 | 0.405 | 0.103 | 0.015 | 1.800 |
Botswana | Sub-Saharan Africa | 3.467 | 0.074 | 3.611 | 3.322 | 9.782 | 0.784 | 59.269 | 0.824 | -0.246 | 0.801 | 2.43 | 1.099 | 0.724 | 0.340 | 0.539 | 0.027 | 0.088 | 0.648 |
Rwanda | Sub-Saharan Africa | 3.415 | 0.068 | 3.548 | 3.282 | 7.676 | 0.552 | 61.400 | 0.897 | 0.061 | 0.167 | 2.43 | 0.364 | 0.202 | 0.407 | 0.627 | 0.227 | 0.493 | 1.095 |
Zimbabwe | Sub-Saharan Africa | 3.145 | 0.058 | 3.259 | 3.030 | 7.943 | 0.750 | 56.201 | 0.677 | -0.047 | 0.821 | 2.43 | 0.457 | 0.649 | 0.243 | 0.359 | 0.157 | 0.075 | 1.205 |
Afghanistan | South Asia | 2.523 | 0.038 | 2.596 | 2.449 | 7.695 | 0.463 | 52.493 | 0.382 | -0.102 | 0.924 | 2.43 | 0.370 | 0.000 | 0.126 | 0.000 | 0.122 | 0.010 | 1.895 |
149 rows × 19 columns
In [21]:
df["Ladder score"]
Out[21]:
Country name
Finland 7.842
Denmark 7.620
Switzerland 7.571
Iceland 7.554
Netherlands 7.464
...
Lesotho 3.512
Botswana 3.467
Rwanda 3.415
Zimbabwe 3.145
Afghanistan 2.523
Name: Ladder score, Length: 149, dtype: float64
In [22]:
countries
Out[22]:
Regional indicator | Ladder score | Standard error of ladder score | upperwhisker | lowerwhisker | Logged GDP per capita | Social support | Healthy life expectancy | Freedom to make life choices | Generosity | Perceptions of corruption | Ladder score in Dystopia | Explained by: Log GDP per capita | Explained by: Social support | Explained by: Healthy life expectancy | Explained by: Freedom to make life choices | Explained by: Generosity | Explained by: Perceptions of corruption | Dystopia + residual | |
Country name | |||||||||||||||||||
Finland | Western Europe | 7.842 | 0.032 | 7.904 | 7.780 | 10.775 | 0.954 | 72.000 | 0.949 | -0.098 | 0.186 | 2.43 | 1.446 | 1.106 | 0.741 | 0.691 | 0.124 | 0.481 | 3.253 |
Denmark | Western Europe | 7.620 | 0.035 | 7.687 | 7.552 | 10.933 | 0.954 | 72.700 | 0.946 | 0.030 | 0.179 | 2.43 | 1.502 | 1.108 | 0.763 | 0.686 | 0.208 | 0.485 | 2.868 |
Switzerland | Western Europe | 7.571 | 0.036 | 7.643 | 7.500 | 11.117 | 0.942 | 74.400 | 0.919 | 0.025 | 0.292 | 2.43 | 1.566 | 1.079 | 0.816 | 0.653 | 0.204 | 0.413 | 2.839 |
Iceland | Western Europe | 7.554 | 0.059 | 7.670 | 7.438 | 10.878 | 0.983 | 73.000 | 0.955 | 0.160 | 0.673 | 2.43 | 1.482 | 1.172 | 0.772 | 0.698 | 0.293 | 0.170 | 2.967 |
Netherlands | Western Europe | 7.464 | 0.027 | 7.518 | 7.410 | 10.932 | 0.942 | 72.400 | 0.913 | 0.175 | 0.338 | 2.43 | 1.501 | 1.079 | 0.753 | 0.647 | 0.302 | 0.384 | 2.798 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
Lesotho | Sub-Saharan Africa | 3.512 | 0.120 | 3.748 | 3.276 | 7.926 | 0.787 | 48.700 | 0.715 | -0.131 | 0.915 | 2.43 | 0.451 | 0.731 | 0.007 | 0.405 | 0.103 | 0.015 | 1.800 |
Botswana | Sub-Saharan Africa | 3.467 | 0.074 | 3.611 | 3.322 | 9.782 | 0.784 | 59.269 | 0.824 | -0.246 | 0.801 | 2.43 | 1.099 | 0.724 | 0.340 | 0.539 | 0.027 | 0.088 | 0.648 |
Rwanda | Sub-Saharan Africa | 3.415 | 0.068 | 3.548 | 3.282 | 7.676 | 0.552 | 61.400 | 0.897 | 0.061 | 0.167 | 2.43 | 0.364 | 0.202 | 0.407 | 0.627 | 0.227 | 0.493 | 1.095 |
Zimbabwe | Sub-Saharan Africa | 3.145 | 0.058 | 3.259 | 3.030 | 7.943 | 0.750 | 56.201 | 0.677 | -0.047 | 0.821 | 2.43 | 0.457 | 0.649 | 0.243 | 0.359 | 0.157 | 0.075 | 1.205 |
Afghanistan | South Asia | 2.523 | 0.038 | 2.596 | 2.449 | 7.695 | 0.463 | 52.493 | 0.382 | -0.102 | 0.924 | 2.43 | 0.370 | 0.000 | 0.126 | 0.000 | 0.122 | 0.010 | 1.895 |
149 rows × 19 columns
In [23]:
countries.sort_values("Healthy life expectancy")
Out[23]:
Regional indicator | Ladder score | Standard error of ladder score | upperwhisker | lowerwhisker | Logged GDP per capita | Social support | Healthy life expectancy | Freedom to make life choices | Generosity | Perceptions of corruption | Ladder score in Dystopia | Explained by: Log GDP per capita | Explained by: Social support | Explained by: Healthy life expectancy | Explained by: Freedom to make life choices | Explained by: Generosity | Explained by: Perceptions of corruption | Dystopia + residual | |
Country name | |||||||||||||||||||
Chad | Sub-Saharan Africa | 4.355 | 0.094 | 4.540 | 4.171 | 7.364 | 0.619 | 48.478 | 0.579 | 0.041 | 0.807 | 2.43 | 0.255 | 0.353 | 0.000 | 0.240 | 0.215 | 0.084 | 3.209 |
Lesotho | Sub-Saharan Africa | 3.512 | 0.120 | 3.748 | 3.276 | 7.926 | 0.787 | 48.700 | 0.715 | -0.131 | 0.915 | 2.43 | 0.451 | 0.731 | 0.007 | 0.405 | 0.103 | 0.015 | 1.800 |
Nigeria | Sub-Saharan Africa | 4.759 | 0.052 | 4.861 | 4.658 | 8.533 | 0.740 | 50.102 | 0.737 | 0.037 | 0.878 | 2.43 | 0.663 | 0.625 | 0.051 | 0.433 | 0.212 | 0.039 | 2.736 |
Ivory Coast | Sub-Saharan Africa | 5.306 | 0.078 | 5.460 | 5.152 | 8.551 | 0.644 | 50.114 | 0.741 | -0.016 | 0.794 | 2.43 | 0.669 | 0.409 | 0.052 | 0.438 | 0.177 | 0.092 | 3.469 |
Swaziland | Sub-Saharan Africa | 4.308 | 0.071 | 4.448 | 4.168 | 9.065 | 0.770 | 50.833 | 0.647 | -0.185 | 0.708 | 2.43 | 0.849 | 0.693 | 0.074 | 0.323 | 0.067 | 0.147 | 2.155 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
Switzerland | Western Europe | 7.571 | 0.036 | 7.643 | 7.500 | 11.117 | 0.942 | 74.400 | 0.919 | 0.025 | 0.292 | 2.43 | 1.566 | 1.079 | 0.816 | 0.653 | 0.204 | 0.413 | 2.839 |
Spain | Western Europe | 6.491 | 0.042 | 6.574 | 6.408 | 10.571 | 0.932 | 74.700 | 0.761 | -0.081 | 0.745 | 2.43 | 1.375 | 1.057 | 0.826 | 0.462 | 0.135 | 0.124 | 2.513 |
Japan | East Asia | 5.940 | 0.040 | 6.020 | 5.861 | 10.611 | 0.884 | 75.100 | 0.796 | -0.258 | 0.638 | 2.43 | 1.389 | 0.949 | 0.838 | 0.504 | 0.020 | 0.192 | 2.048 |
Hong Kong S.A.R. of China | East Asia | 5.477 | 0.049 | 5.573 | 5.380 | 11.000 | 0.836 | 76.820 | 0.717 | 0.067 | 0.403 | 2.43 | 1.525 | 0.841 | 0.893 | 0.408 | 0.232 | 0.342 | 1.236 |
Singapore | Southeast Asia | 6.377 | 0.043 | 6.460 | 6.293 | 11.488 | 0.915 | 76.953 | 0.927 | -0.018 | 0.082 | 2.43 | 1.695 | 1.019 | 0.897 | 0.664 | 0.176 | 0.547 | 1.379 |
149 rows × 19 columns
In [24]:
countries.sort_values("Healthy life expectancy", ascending=False)
Out[24]:
Regional indicator | Ladder score | Standard error of ladder score | upperwhisker | lowerwhisker | Logged GDP per capita | Social support | Healthy life expectancy | Freedom to make life choices | Generosity | Perceptions of corruption | Ladder score in Dystopia | Explained by: Log GDP per capita | Explained by: Social support | Explained by: Healthy life expectancy | Explained by: Freedom to make life choices | Explained by: Generosity | Explained by: Perceptions of corruption | Dystopia + residual | |
Country name | |||||||||||||||||||
Singapore | Southeast Asia | 6.377 | 0.043 | 6.460 | 6.293 | 11.488 | 0.915 | 76.953 | 0.927 | -0.018 | 0.082 | 2.43 | 1.695 | 1.019 | 0.897 | 0.664 | 0.176 | 0.547 | 1.379 |
Hong Kong S.A.R. of China | East Asia | 5.477 | 0.049 | 5.573 | 5.380 | 11.000 | 0.836 | 76.820 | 0.717 | 0.067 | 0.403 | 2.43 | 1.525 | 0.841 | 0.893 | 0.408 | 0.232 | 0.342 | 1.236 |
Japan | East Asia | 5.940 | 0.040 | 6.020 | 5.861 | 10.611 | 0.884 | 75.100 | 0.796 | -0.258 | 0.638 | 2.43 | 1.389 | 0.949 | 0.838 | 0.504 | 0.020 | 0.192 | 2.048 |
Spain | Western Europe | 6.491 | 0.042 | 6.574 | 6.408 | 10.571 | 0.932 | 74.700 | 0.761 | -0.081 | 0.745 | 2.43 | 1.375 | 1.057 | 0.826 | 0.462 | 0.135 | 0.124 | 2.513 |
Switzerland | Western Europe | 7.571 | 0.036 | 7.643 | 7.500 | 11.117 | 0.942 | 74.400 | 0.919 | 0.025 | 0.292 | 2.43 | 1.566 | 1.079 | 0.816 | 0.653 | 0.204 | 0.413 | 2.839 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
Swaziland | Sub-Saharan Africa | 4.308 | 0.071 | 4.448 | 4.168 | 9.065 | 0.770 | 50.833 | 0.647 | -0.185 | 0.708 | 2.43 | 0.849 | 0.693 | 0.074 | 0.323 | 0.067 | 0.147 | 2.155 |
Ivory Coast | Sub-Saharan Africa | 5.306 | 0.078 | 5.460 | 5.152 | 8.551 | 0.644 | 50.114 | 0.741 | -0.016 | 0.794 | 2.43 | 0.669 | 0.409 | 0.052 | 0.438 | 0.177 | 0.092 | 3.469 |
Nigeria | Sub-Saharan Africa | 4.759 | 0.052 | 4.861 | 4.658 | 8.533 | 0.740 | 50.102 | 0.737 | 0.037 | 0.878 | 2.43 | 0.663 | 0.625 | 0.051 | 0.433 | 0.212 | 0.039 | 2.736 |
Lesotho | Sub-Saharan Africa | 3.512 | 0.120 | 3.748 | 3.276 | 7.926 | 0.787 | 48.700 | 0.715 | -0.131 | 0.915 | 2.43 | 0.451 | 0.731 | 0.007 | 0.405 | 0.103 | 0.015 | 1.800 |
Chad | Sub-Saharan Africa | 4.355 | 0.094 | 4.540 | 4.171 | 7.364 | 0.619 | 48.478 | 0.579 | 0.041 | 0.807 | 2.43 | 0.255 | 0.353 | 0.000 | 0.240 | 0.215 | 0.084 | 3.209 |
149 rows × 19 columns
In [25]:
countries
Out[25]:
Regional indicator | Ladder score | Standard error of ladder score | upperwhisker | lowerwhisker | Logged GDP per capita | Social support | Healthy life expectancy | Freedom to make life choices | Generosity | Perceptions of corruption | Ladder score in Dystopia | Explained by: Log GDP per capita | Explained by: Social support | Explained by: Healthy life expectancy | Explained by: Freedom to make life choices | Explained by: Generosity | Explained by: Perceptions of corruption | Dystopia + residual | |
Country name | |||||||||||||||||||
Finland | Western Europe | 7.842 | 0.032 | 7.904 | 7.780 | 10.775 | 0.954 | 72.000 | 0.949 | -0.098 | 0.186 | 2.43 | 1.446 | 1.106 | 0.741 | 0.691 | 0.124 | 0.481 | 3.253 |
Denmark | Western Europe | 7.620 | 0.035 | 7.687 | 7.552 | 10.933 | 0.954 | 72.700 | 0.946 | 0.030 | 0.179 | 2.43 | 1.502 | 1.108 | 0.763 | 0.686 | 0.208 | 0.485 | 2.868 |
Switzerland | Western Europe | 7.571 | 0.036 | 7.643 | 7.500 | 11.117 | 0.942 | 74.400 | 0.919 | 0.025 | 0.292 | 2.43 | 1.566 | 1.079 | 0.816 | 0.653 | 0.204 | 0.413 | 2.839 |
Iceland | Western Europe | 7.554 | 0.059 | 7.670 | 7.438 | 10.878 | 0.983 | 73.000 | 0.955 | 0.160 | 0.673 | 2.43 | 1.482 | 1.172 | 0.772 | 0.698 | 0.293 | 0.170 | 2.967 |
Netherlands | Western Europe | 7.464 | 0.027 | 7.518 | 7.410 | 10.932 | 0.942 | 72.400 | 0.913 | 0.175 | 0.338 | 2.43 | 1.501 | 1.079 | 0.753 | 0.647 | 0.302 | 0.384 | 2.798 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
Lesotho | Sub-Saharan Africa | 3.512 | 0.120 | 3.748 | 3.276 | 7.926 | 0.787 | 48.700 | 0.715 | -0.131 | 0.915 | 2.43 | 0.451 | 0.731 | 0.007 | 0.405 | 0.103 | 0.015 | 1.800 |
Botswana | Sub-Saharan Africa | 3.467 | 0.074 | 3.611 | 3.322 | 9.782 | 0.784 | 59.269 | 0.824 | -0.246 | 0.801 | 2.43 | 1.099 | 0.724 | 0.340 | 0.539 | 0.027 | 0.088 | 0.648 |
Rwanda | Sub-Saharan Africa | 3.415 | 0.068 | 3.548 | 3.282 | 7.676 | 0.552 | 61.400 | 0.897 | 0.061 | 0.167 | 2.43 | 0.364 | 0.202 | 0.407 | 0.627 | 0.227 | 0.493 | 1.095 |
Zimbabwe | Sub-Saharan Africa | 3.145 | 0.058 | 3.259 | 3.030 | 7.943 | 0.750 | 56.201 | 0.677 | -0.047 | 0.821 | 2.43 | 0.457 | 0.649 | 0.243 | 0.359 | 0.157 | 0.075 | 1.205 |
Afghanistan | South Asia | 2.523 | 0.038 | 2.596 | 2.449 | 7.695 | 0.463 | 52.493 | 0.382 | -0.102 | 0.924 | 2.43 | 0.370 | 0.000 | 0.126 | 0.000 | 0.122 | 0.010 | 1.895 |
149 rows × 19 columns
In [26]:
countries.sort_values("Healthy life expectancy", ascending=False, inplace=True)
In [27]:
countries
Out[27]:
Regional indicator | Ladder score | Standard error of ladder score | upperwhisker | lowerwhisker | Logged GDP per capita | Social support | Healthy life expectancy | Freedom to make life choices | Generosity | Perceptions of corruption | Ladder score in Dystopia | Explained by: Log GDP per capita | Explained by: Social support | Explained by: Healthy life expectancy | Explained by: Freedom to make life choices | Explained by: Generosity | Explained by: Perceptions of corruption | Dystopia + residual | |
Country name | |||||||||||||||||||
Singapore | Southeast Asia | 6.377 | 0.043 | 6.460 | 6.293 | 11.488 | 0.915 | 76.953 | 0.927 | -0.018 | 0.082 | 2.43 | 1.695 | 1.019 | 0.897 | 0.664 | 0.176 | 0.547 | 1.379 |
Hong Kong S.A.R. of China | East Asia | 5.477 | 0.049 | 5.573 | 5.380 | 11.000 | 0.836 | 76.820 | 0.717 | 0.067 | 0.403 | 2.43 | 1.525 | 0.841 | 0.893 | 0.408 | 0.232 | 0.342 | 1.236 |
Japan | East Asia | 5.940 | 0.040 | 6.020 | 5.861 | 10.611 | 0.884 | 75.100 | 0.796 | -0.258 | 0.638 | 2.43 | 1.389 | 0.949 | 0.838 | 0.504 | 0.020 | 0.192 | 2.048 |
Spain | Western Europe | 6.491 | 0.042 | 6.574 | 6.408 | 10.571 | 0.932 | 74.700 | 0.761 | -0.081 | 0.745 | 2.43 | 1.375 | 1.057 | 0.826 | 0.462 | 0.135 | 0.124 | 2.513 |
Switzerland | Western Europe | 7.571 | 0.036 | 7.643 | 7.500 | 11.117 | 0.942 | 74.400 | 0.919 | 0.025 | 0.292 | 2.43 | 1.566 | 1.079 | 0.816 | 0.653 | 0.204 | 0.413 | 2.839 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
Swaziland | Sub-Saharan Africa | 4.308 | 0.071 | 4.448 | 4.168 | 9.065 | 0.770 | 50.833 | 0.647 | -0.185 | 0.708 | 2.43 | 0.849 | 0.693 | 0.074 | 0.323 | 0.067 | 0.147 | 2.155 |
Ivory Coast | Sub-Saharan Africa | 5.306 | 0.078 | 5.460 | 5.152 | 8.551 | 0.644 | 50.114 | 0.741 | -0.016 | 0.794 | 2.43 | 0.669 | 0.409 | 0.052 | 0.438 | 0.177 | 0.092 | 3.469 |
Nigeria | Sub-Saharan Africa | 4.759 | 0.052 | 4.861 | 4.658 | 8.533 | 0.740 | 50.102 | 0.737 | 0.037 | 0.878 | 2.43 | 0.663 | 0.625 | 0.051 | 0.433 | 0.212 | 0.039 | 2.736 |
Lesotho | Sub-Saharan Africa | 3.512 | 0.120 | 3.748 | 3.276 | 7.926 | 0.787 | 48.700 | 0.715 | -0.131 | 0.915 | 2.43 | 0.451 | 0.731 | 0.007 | 0.405 | 0.103 | 0.015 | 1.800 |
Chad | Sub-Saharan Africa | 4.355 | 0.094 | 4.540 | 4.171 | 7.364 | 0.619 | 48.478 | 0.579 | 0.041 | 0.807 | 2.43 | 0.255 | 0.353 | 0.000 | 0.240 | 0.215 | 0.084 | 3.209 |
149 rows × 19 columns
In [28]:
houses = pd.read_csv("data/kc_house_data.csv")titanic = pd.read_csv("data/titanic.csv")
In [29]:
houses.sort_values("price", ascending=False)
Out[29]:
id | date | price | bedrooms | bathrooms | sqft_living | sqft_lot | floors | waterfront | view | ... | grade | sqft_above | sqft_basement | yr_built | yr_renovated | zipcode | lat | long | sqft_living15 | sqft_lot15 | |
7252 | 6762700020 | 20141013T000000 | 7700000.0 | 6 | 8.00 | 12050 | 27600 | 2.5 | 0 | 3 | ... | 13 | 8570 | 3480 | 1910 | 1987 | 98102 | 47.6298 | -122.323 | 3940 | 8800 |
3914 | 9808700762 | 20140611T000000 | 7062500.0 | 5 | 4.50 | 10040 | 37325 | 2.0 | 1 | 2 | ... | 11 | 7680 | 2360 | 1940 | 2001 | 98004 | 47.6500 | -122.214 | 3930 | 25449 |
9254 | 9208900037 | 20140919T000000 | 6885000.0 | 6 | 7.75 | 9890 | 31374 | 2.0 | 0 | 4 | ... | 13 | 8860 | 1030 | 2001 | 0 | 98039 | 47.6305 | -122.240 | 4540 | 42730 |
4411 | 2470100110 | 20140804T000000 | 5570000.0 | 5 | 5.75 | 9200 | 35069 | 2.0 | 0 | 0 | ... | 13 | 6200 | 3000 | 2001 | 0 | 98039 | 47.6289 | -122.233 | 3560 | 24345 |
1448 | 8907500070 | 20150413T000000 | 5350000.0 | 5 | 5.00 | 8000 | 23985 | 2.0 | 0 | 4 | ... | 12 | 6720 | 1280 | 2009 | 0 | 98004 | 47.6232 | -122.220 | 4600 | 21750 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
8274 | 3883800011 | 20141105T000000 | 82000.0 | 3 | 1.00 | 860 | 10426 | 1.0 | 0 | 0 | ... | 6 | 860 | 0 | 1954 | 0 | 98146 | 47.4987 | -122.341 | 1140 | 11250 |
16198 | 3028200080 | 20150324T000000 | 81000.0 | 2 | 1.00 | 730 | 9975 | 1.0 | 0 | 0 | ... | 5 | 730 | 0 | 1943 | 0 | 98168 | 47.4808 | -122.315 | 860 | 9000 |
465 | 8658300340 | 20140523T000000 | 80000.0 | 1 | 0.75 | 430 | 5050 | 1.0 | 0 | 0 | ... | 4 | 430 | 0 | 1912 | 0 | 98014 | 47.6499 | -121.909 | 1200 | 7500 |
15293 | 40000362 | 20140506T000000 | 78000.0 | 2 | 1.00 | 780 | 16344 | 1.0 | 0 | 0 | ... | 5 | 780 | 0 | 1942 | 0 | 98168 | 47.4739 | -122.280 | 1700 | 10387 |
1149 | 3421079032 | 20150217T000000 | 75000.0 | 1 | 0.00 | 670 | 43377 | 1.0 | 0 | 0 | ... | 3 | 670 | 0 | 1966 | 0 | 98022 | 47.2638 | -121.906 | 1160 | 42882 |
21613 rows × 21 columns
In [30]:
houses.sort_values("bedrooms", ascending=False)
Out[30]:
id | date | price | bedrooms | bathrooms | sqft_living | sqft_lot | floors | waterfront | view | ... | grade | sqft_above | sqft_basement | yr_built | yr_renovated | zipcode | lat | long | sqft_living15 | sqft_lot15 | |
15870 | 2402100895 | 20140625T000000 | 640000.0 | 33 | 1.75 | 1620 | 6000 | 1.0 | 0 | 0 | ... | 7 | 1040 | 580 | 1947 | 0 | 98103 | 47.6878 | -122.331 | 1330 | 4700 |
8757 | 1773100755 | 20140821T000000 | 520000.0 | 11 | 3.00 | 3000 | 4960 | 2.0 | 0 | 0 | ... | 7 | 2400 | 600 | 1918 | 1999 | 98106 | 47.5560 | -122.363 | 1420 | 4960 |
15161 | 5566100170 | 20141029T000000 | 650000.0 | 10 | 2.00 | 3610 | 11914 | 2.0 | 0 | 0 | ... | 7 | 3010 | 600 | 1958 | 0 | 98006 | 47.5705 | -122.175 | 2040 | 11914 |
13314 | 627300145 | 20140814T000000 | 1148000.0 | 10 | 5.25 | 4590 | 10920 | 1.0 | 0 | 2 | ... | 9 | 2500 | 2090 | 2008 | 0 | 98004 | 47.5861 | -122.113 | 2730 | 10400 |
19254 | 8812401450 | 20141229T000000 | 660000.0 | 10 | 3.00 | 2920 | 3745 | 2.0 | 0 | 0 | ... | 7 | 1860 | 1060 | 1913 | 0 | 98105 | 47.6635 | -122.320 | 1810 | 3745 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
19452 | 3980300371 | 20140926T000000 | 142000.0 | 0 | 0.00 | 290 | 20875 | 1.0 | 0 | 0 | ... | 1 | 290 | 0 | 1963 | 0 | 98024 | 47.5308 | -121.888 | 1620 | 22850 |
8484 | 2310060040 | 20140925T000000 | 240000.0 | 0 | 2.50 | 1810 | 5669 | 2.0 | 0 | 0 | ... | 7 | 1810 | 0 | 2003 | 0 | 98038 | 47.3493 | -122.053 | 1810 | 5685 |
875 | 6306400140 | 20140612T000000 | 1095000.0 | 0 | 0.00 | 3064 | 4764 | 3.5 | 0 | 2 | ... | 7 | 3064 | 0 | 1990 | 0 | 98102 | 47.6362 | -122.322 | 2360 | 4000 |
8477 | 2569500210 | 20141117T000000 | 339950.0 | 0 | 2.50 | 2290 | 8319 | 2.0 | 0 | 0 | ... | 8 | 2290 | 0 | 1985 | 0 | 98042 | 47.3473 | -122.151 | 2500 | 8751 |
9773 | 3374500520 | 20150429T000000 | 355000.0 | 0 | 0.00 | 2460 | 8049 | 2.0 | 0 | 0 | ... | 8 | 2460 | 0 | 1990 | 0 | 98031 | 47.4095 | -122.168 | 2520 | 8050 |
21613 rows × 21 columns
In [31]:
houses.sort_values(["bedrooms", "bathrooms"], ascending=False)
Out[31]:
id | date | price | bedrooms | bathrooms | sqft_living | sqft_lot | floors | waterfront | view | ... | grade | sqft_above | sqft_basement | yr_built | yr_renovated | zipcode | lat | long | sqft_living15 | sqft_lot15 | |
15870 | 2402100895 | 20140625T000000 | 640000.0 | 33 | 1.75 | 1620 | 6000 | 1.0 | 0 | 0 | ... | 7 | 1040 | 580 | 1947 | 0 | 98103 | 47.6878 | -122.331 | 1330 | 4700 |
8757 | 1773100755 | 20140821T000000 | 520000.0 | 11 | 3.00 | 3000 | 4960 | 2.0 | 0 | 0 | ... | 7 | 2400 | 600 | 1918 | 1999 | 98106 | 47.5560 | -122.363 | 1420 | 4960 |
13314 | 627300145 | 20140814T000000 | 1148000.0 | 10 | 5.25 | 4590 | 10920 | 1.0 | 0 | 2 | ... | 9 | 2500 | 2090 | 2008 | 0 | 98004 | 47.5861 | -122.113 | 2730 | 10400 |
19254 | 8812401450 | 20141229T000000 | 660000.0 | 10 | 3.00 | 2920 | 3745 | 2.0 | 0 | 0 | ... | 7 | 1860 | 1060 | 1913 | 0 | 98105 | 47.6635 | -122.320 | 1810 | 3745 |
15161 | 5566100170 | 20141029T000000 | 650000.0 | 10 | 2.00 | 3610 | 11914 | 2.0 | 0 | 0 | ... | 7 | 3010 | 600 | 1958 | 0 | 98006 | 47.5705 | -122.175 | 2040 | 11914 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
6994 | 2954400190 | 20140624T000000 | 1295650.0 | 0 | 0.00 | 4810 | 28008 | 2.0 | 0 | 0 | ... | 12 | 4810 | 0 | 1990 | 0 | 98053 | 47.6642 | -122.069 | 4740 | 35061 |
9773 | 3374500520 | 20150429T000000 | 355000.0 | 0 | 0.00 | 2460 | 8049 | 2.0 | 0 | 0 | ... | 8 | 2460 | 0 | 1990 | 0 | 98031 | 47.4095 | -122.168 | 2520 | 8050 |
9854 | 7849202190 | 20141223T000000 | 235000.0 | 0 | 0.00 | 1470 | 4800 | 2.0 | 0 | 0 | ... | 7 | 1470 | 0 | 1996 | 0 | 98065 | 47.5265 | -121.828 | 1060 | 7200 |
14423 | 9543000205 | 20150413T000000 | 139950.0 | 0 | 0.00 | 844 | 4269 | 1.0 | 0 | 0 | ... | 7 | 844 | 0 | 1913 | 0 | 98001 | 47.2781 | -122.250 | 1380 | 9600 |
19452 | 3980300371 | 20140926T000000 | 142000.0 | 0 | 0.00 | 290 | 20875 | 1.0 | 0 | 0 | ... | 1 | 290 | 0 | 1963 | 0 | 98024 | 47.5308 | -121.888 | 1620 | 22850 |
21613 rows × 21 columns
In [32]:
houses.sort_values(["bathrooms", "bedrooms"], ascending=False)
Out[32]:
id | date | price | bedrooms | bathrooms | sqft_living | sqft_lot | floors | waterfront | view | ... | grade | sqft_above | sqft_basement | yr_built | yr_renovated | zipcode | lat | long | sqft_living15 | sqft_lot15 | |
12777 | 1225069038 | 20140505T000000 | 2280000.0 | 7 | 8.00 | 13540 | 307752 | 3.0 | 0 | 4 | ... | 12 | 9410 | 4130 | 1999 | 0 | 98053 | 47.6675 | -121.986 | 4850 | 217800 |
7252 | 6762700020 | 20141013T000000 | 7700000.0 | 6 | 8.00 | 12050 | 27600 | 2.5 | 0 | 3 | ... | 13 | 8570 | 3480 | 1910 | 1987 | 98102 | 47.6298 | -122.323 | 3940 | 8800 |
9254 | 9208900037 | 20140919T000000 | 6885000.0 | 6 | 7.75 | 9890 | 31374 | 2.0 | 0 | 4 | ... | 13 | 8860 | 1030 | 2001 | 0 | 98039 | 47.6305 | -122.240 | 4540 | 42730 |
8546 | 424049043 | 20140811T000000 | 450000.0 | 9 | 7.50 | 4050 | 6504 | 2.0 | 0 | 0 | ... | 7 | 4050 | 0 | 1996 | 0 | 98144 | 47.5923 | -122.301 | 1448 | 3866 |
4024 | 9175600025 | 20141007T000000 | 800000.0 | 7 | 6.75 | 7480 | 41664 | 2.0 | 0 | 2 | ... | 11 | 5080 | 2400 | 1953 | 0 | 98166 | 47.4643 | -122.368 | 2810 | 33190 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
6994 | 2954400190 | 20140624T000000 | 1295650.0 | 0 | 0.00 | 4810 | 28008 | 2.0 | 0 | 0 | ... | 12 | 4810 | 0 | 1990 | 0 | 98053 | 47.6642 | -122.069 | 4740 | 35061 |
9773 | 3374500520 | 20150429T000000 | 355000.0 | 0 | 0.00 | 2460 | 8049 | 2.0 | 0 | 0 | ... | 8 | 2460 | 0 | 1990 | 0 | 98031 | 47.4095 | -122.168 | 2520 | 8050 |
9854 | 7849202190 | 20141223T000000 | 235000.0 | 0 | 0.00 | 1470 | 4800 | 2.0 | 0 | 0 | ... | 7 | 1470 | 0 | 1996 | 0 | 98065 | 47.5265 | -121.828 | 1060 | 7200 |
14423 | 9543000205 | 20150413T000000 | 139950.0 | 0 | 0.00 | 844 | 4269 | 1.0 | 0 | 0 | ... | 7 | 844 | 0 | 1913 | 0 | 98001 | 47.2781 | -122.250 | 1380 | 9600 |
19452 | 3980300371 | 20140926T000000 | 142000.0 | 0 | 0.00 | 290 | 20875 | 1.0 | 0 | 0 | ... | 1 | 290 | 0 | 1963 | 0 | 98024 | 47.5308 | -121.888 | 1620 | 22850 |
21613 rows × 21 columns
In [33]:
titanic
Out[33]:
pclass | survived | name | sex | age | sibsp | parch | ticket | fare | cabin | embarked | boat | body | home.dest | |
0 | 1 | 1 | Allen, Miss. Elisabeth Walton | female | 29 | 0 | 0 | 24160 | 211.3375 | B5 | S | 2 | ? | St Louis, MO |
1 | 1 | 1 | Allison, Master. Hudson Trevor | male | 0.9167 | 1 | 2 | 113781 | 151.55 | C22 C26 | S | 11 | ? | Montreal, PQ / Chesterville, ON |
2 | 1 | 0 | Allison, Miss. Helen Loraine | female | 2 | 1 | 2 | 113781 | 151.55 | C22 C26 | S | ? | ? | Montreal, PQ / Chesterville, ON |
3 | 1 | 0 | Allison, Mr. Hudson Joshua Creighton | male | 30 | 1 | 2 | 113781 | 151.55 | C22 C26 | S | ? | 135 | Montreal, PQ / Chesterville, ON |
4 | 1 | 0 | Allison, Mrs. Hudson J C (Bessie Waldo Daniels) | female | 25 | 1 | 2 | 113781 | 151.55 | C22 C26 | S | ? | ? | Montreal, PQ / Chesterville, ON |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
1304 | 3 | 0 | Zabour, Miss. Hileni | female | 14.5 | 1 | 0 | 2665 | 14.4542 | ? | C | ? | 328 | ? |
1305 | 3 | 0 | Zabour, Miss. Thamine | female | ? | 1 | 0 | 2665 | 14.4542 | ? | C | ? | ? | ? |
1306 | 3 | 0 | Zakarian, Mr. Mapriededer | male | 26.5 | 0 | 0 | 2656 | 7.225 | ? | C | ? | 304 | ? |
1307 | 3 | 0 | Zakarian, Mr. Ortin | male | 27 | 0 | 0 | 2670 | 7.225 | ? | C | ? | ? | ? |
1308 | 3 | 0 | Zimmerman, Mr. Leo | male | 29 | 0 | 0 | 315082 | 7.875 | ? | S | ? | ? | ? |
1309 rows × 14 columns
In [34]:
titanic.sort_values("name")
Out[34]:
pclass | survived | name | sex | age | sibsp | parch | ticket | fare | cabin | embarked | boat | body | home.dest | |
600 | 3 | 0 | Abbing, Mr. Anthony | male | 42 | 0 | 0 | C.A. 5547 | 7.55 | ? | S | ? | ? | ? |
601 | 3 | 0 | Abbott, Master. Eugene Joseph | male | 13 | 0 | 2 | C.A. 2673 | 20.25 | ? | S | ? | ? | East Providence, RI |
602 | 3 | 0 | Abbott, Mr. Rossmore Edward | male | 16 | 1 | 1 | C.A. 2673 | 20.25 | ? | S | ? | 190 | East Providence, RI |
603 | 3 | 1 | Abbott, Mrs. Stanton (Rosa Hunt) | female | 35 | 1 | 1 | C.A. 2673 | 20.25 | ? | S | A | ? | East Providence, RI |
604 | 3 | 1 | Abelseth, Miss. Karen Marie | female | 16 | 0 | 0 | 348125 | 7.65 | ? | S | 16 | ? | Norway Los Angeles, CA |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
392 | 2 | 1 | del Carlo, Mrs. Sebastiano (Argenia Genovesi) | female | 24 | 1 | 0 | SC/PARIS 2167 | 27.7208 | ? | C | 12 | ? | Lucca, Italy / California |
1262 | 3 | 0 | van Billiard, Master. James William | male | ? | 1 | 1 | A/5. 851 | 14.5 | ? | S | ? | ? | ? |
1263 | 3 | 0 | van Billiard, Master. Walter John | male | 11.5 | 1 | 1 | A/5. 851 | 14.5 | ? | S | ? | 1 | ? |
1264 | 3 | 0 | van Billiard, Mr. Austin Blyler | male | 40.5 | 0 | 2 | A/5. 851 | 14.5 | ? | S | ? | 255 | ? |
1268 | 3 | 0 | van Melkebeke, Mr. Philemon | male | ? | 0 | 0 | 345777 | 9.5 | ? | S | ? | ? | ? |
1309 rows × 14 columns
In [35]:
titanic.sort_values("name",key=lambda col: col.str.lower())
Out[35]:
pclass | survived | name | sex | age | sibsp | parch | ticket | fare | cabin | embarked | boat | body | home.dest | |
600 | 3 | 0 | Abbing, Mr. Anthony | male | 42 | 0 | 0 | C.A. 5547 | 7.55 | ? | S | ? | ? | ? |
601 | 3 | 0 | Abbott, Master. Eugene Joseph | male | 13 | 0 | 2 | C.A. 2673 | 20.25 | ? | S | ? | ? | East Providence, RI |
602 | 3 | 0 | Abbott, Mr. Rossmore Edward | male | 16 | 1 | 1 | C.A. 2673 | 20.25 | ? | S | ? | 190 | East Providence, RI |
603 | 3 | 1 | Abbott, Mrs. Stanton (Rosa Hunt) | female | 35 | 1 | 1 | C.A. 2673 | 20.25 | ? | S | A | ? | East Providence, RI |
604 | 3 | 1 | Abelseth, Miss. Karen Marie | female | 16 | 0 | 0 | 348125 | 7.65 | ? | S | 16 | ? | Norway Los Angeles, CA |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
1304 | 3 | 0 | Zabour, Miss. Hileni | female | 14.5 | 1 | 0 | 2665 | 14.4542 | ? | C | ? | 328 | ? |
1305 | 3 | 0 | Zabour, Miss. Thamine | female | ? | 1 | 0 | 2665 | 14.4542 | ? | C | ? | ? | ? |
1306 | 3 | 0 | Zakarian, Mr. Mapriededer | male | 26.5 | 0 | 0 | 2656 | 7.225 | ? | C | ? | 304 | ? |
1307 | 3 | 0 | Zakarian, Mr. Ortin | male | 27 | 0 | 0 | 2670 | 7.225 | ? | C | ? | ? | ? |
1308 | 3 | 0 | Zimmerman, Mr. Leo | male | 29 | 0 | 0 | 315082 | 7.875 | ? | S | ? | ? | ? |
1309 rows × 14 columns
In [36]:
countries
Out[36]:
Regional indicator | Ladder score | Standard error of ladder score | upperwhisker | lowerwhisker | Logged GDP per capita | Social support | Healthy life expectancy | Freedom to make life choices | Generosity | Perceptions of corruption | Ladder score in Dystopia | Explained by: Log GDP per capita | Explained by: Social support | Explained by: Healthy life expectancy | Explained by: Freedom to make life choices | Explained by: Generosity | Explained by: Perceptions of corruption | Dystopia + residual | |
Country name | |||||||||||||||||||
Singapore | Southeast Asia | 6.377 | 0.043 | 6.460 | 6.293 | 11.488 | 0.915 | 76.953 | 0.927 | -0.018 | 0.082 | 2.43 | 1.695 | 1.019 | 0.897 | 0.664 | 0.176 | 0.547 | 1.379 |
Hong Kong S.A.R. of China | East Asia | 5.477 | 0.049 | 5.573 | 5.380 | 11.000 | 0.836 | 76.820 | 0.717 | 0.067 | 0.403 | 2.43 | 1.525 | 0.841 | 0.893 | 0.408 | 0.232 | 0.342 | 1.236 |
Japan | East Asia | 5.940 | 0.040 | 6.020 | 5.861 | 10.611 | 0.884 | 75.100 | 0.796 | -0.258 | 0.638 | 2.43 | 1.389 | 0.949 | 0.838 | 0.504 | 0.020 | 0.192 | 2.048 |
Spain | Western Europe | 6.491 | 0.042 | 6.574 | 6.408 | 10.571 | 0.932 | 74.700 | 0.761 | -0.081 | 0.745 | 2.43 | 1.375 | 1.057 | 0.826 | 0.462 | 0.135 | 0.124 | 2.513 |
Switzerland | Western Europe | 7.571 | 0.036 | 7.643 | 7.500 | 11.117 | 0.942 | 74.400 | 0.919 | 0.025 | 0.292 | 2.43 | 1.566 | 1.079 | 0.816 | 0.653 | 0.204 | 0.413 | 2.839 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
Swaziland | Sub-Saharan Africa | 4.308 | 0.071 | 4.448 | 4.168 | 9.065 | 0.770 | 50.833 | 0.647 | -0.185 | 0.708 | 2.43 | 0.849 | 0.693 | 0.074 | 0.323 | 0.067 | 0.147 | 2.155 |
Ivory Coast | Sub-Saharan Africa | 5.306 | 0.078 | 5.460 | 5.152 | 8.551 | 0.644 | 50.114 | 0.741 | -0.016 | 0.794 | 2.43 | 0.669 | 0.409 | 0.052 | 0.438 | 0.177 | 0.092 | 3.469 |
Nigeria | Sub-Saharan Africa | 4.759 | 0.052 | 4.861 | 4.658 | 8.533 | 0.740 | 50.102 | 0.737 | 0.037 | 0.878 | 2.43 | 0.663 | 0.625 | 0.051 | 0.433 | 0.212 | 0.039 | 2.736 |
Lesotho | Sub-Saharan Africa | 3.512 | 0.120 | 3.748 | 3.276 | 7.926 | 0.787 | 48.700 | 0.715 | -0.131 | 0.915 | 2.43 | 0.451 | 0.731 | 0.007 | 0.405 | 0.103 | 0.015 | 1.800 |
Chad | Sub-Saharan Africa | 4.355 | 0.094 | 4.540 | 4.171 | 7.364 | 0.619 | 48.478 | 0.579 | 0.041 | 0.807 | 2.43 | 0.255 | 0.353 | 0.000 | 0.240 | 0.215 | 0.084 | 3.209 |
149 rows × 19 columns
In [37]:
countries.sort_index()
Out[37]:
Regional indicator | Ladder score | Standard error of ladder score | upperwhisker | lowerwhisker | Logged GDP per capita | Social support | Healthy life expectancy | Freedom to make life choices | Generosity | Perceptions of corruption | Ladder score in Dystopia | Explained by: Log GDP per capita | Explained by: Social support | Explained by: Healthy life expectancy | Explained by: Freedom to make life choices | Explained by: Generosity | Explained by: Perceptions of corruption | Dystopia + residual | |
Country name | |||||||||||||||||||
Afghanistan | South Asia | 2.523 | 0.038 | 2.596 | 2.449 | 7.695 | 0.463 | 52.493 | 0.382 | -0.102 | 0.924 | 2.43 | 0.370 | 0.000 | 0.126 | 0.000 | 0.122 | 0.010 | 1.895 |
Albania | Central and Eastern Europe | 5.117 | 0.059 | 5.234 | 5.001 | 9.520 | 0.697 | 68.999 | 0.785 | -0.030 | 0.901 | 2.43 | 1.008 | 0.529 | 0.646 | 0.491 | 0.168 | 0.024 | 2.250 |
Algeria | Middle East and North Africa | 4.887 | 0.053 | 4.991 | 4.783 | 9.342 | 0.802 | 66.005 | 0.480 | -0.067 | 0.752 | 2.43 | 0.946 | 0.765 | 0.552 | 0.119 | 0.144 | 0.120 | 2.242 |
Argentina | Latin America and Caribbean | 5.929 | 0.056 | 6.040 | 5.819 | 9.962 | 0.898 | 69.000 | 0.828 | -0.182 | 0.834 | 2.43 | 1.162 | 0.980 | 0.646 | 0.544 | 0.069 | 0.067 | 2.461 |
Armenia | Commonwealth of Independent States | 5.283 | 0.058 | 5.397 | 5.168 | 9.487 | 0.799 | 67.055 | 0.825 | -0.168 | 0.629 | 2.43 | 0.996 | 0.758 | 0.585 | 0.540 | 0.079 | 0.198 | 2.127 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
Venezuela | Latin America and Caribbean | 4.892 | 0.064 | 5.017 | 4.767 | 9.073 | 0.861 | 66.700 | 0.615 | -0.169 | 0.827 | 2.43 | 0.852 | 0.897 | 0.574 | 0.284 | 0.078 | 0.072 | 2.135 |
Vietnam | Southeast Asia | 5.411 | 0.039 | 5.488 | 5.334 | 8.973 | 0.850 | 68.034 | 0.940 | -0.098 | 0.796 | 2.43 | 0.817 | 0.873 | 0.616 | 0.679 | 0.124 | 0.091 | 2.211 |
Yemen | Middle East and North Africa | 3.658 | 0.070 | 3.794 | 3.521 | 7.578 | 0.832 | 57.122 | 0.602 | -0.147 | 0.800 | 2.43 | 0.329 | 0.831 | 0.272 | 0.268 | 0.092 | 0.089 | 1.776 |
Zambia | Sub-Saharan Africa | 4.073 | 0.069 | 4.209 | 3.938 | 8.145 | 0.708 | 55.809 | 0.782 | 0.061 | 0.823 | 2.43 | 0.528 | 0.552 | 0.231 | 0.487 | 0.227 | 0.074 | 1.975 |
Zimbabwe | Sub-Saharan Africa | 3.145 | 0.058 | 3.259 | 3.030 | 7.943 | 0.750 | 56.201 | 0.677 | -0.047 | 0.821 | 2.43 | 0.457 | 0.649 | 0.243 | 0.359 | 0.157 | 0.075 | 1.205 |
149 rows × 19 columns
In [38]:
countries.sort_index(ascending=False, inplace=True)
In [39]:
countries
Out[39]:
Regional indicator | Ladder score | Standard error of ladder score | upperwhisker | lowerwhisker | Logged GDP per capita | Social support | Healthy life expectancy | Freedom to make life choices | Generosity | Perceptions of corruption | Ladder score in Dystopia | Explained by: Log GDP per capita | Explained by: Social support | Explained by: Healthy life expectancy | Explained by: Freedom to make life choices | Explained by: Generosity | Explained by: Perceptions of corruption | Dystopia + residual | |
Country name | |||||||||||||||||||
Zimbabwe | Sub-Saharan Africa | 3.145 | 0.058 | 3.259 | 3.030 | 7.943 | 0.750 | 56.201 | 0.677 | -0.047 | 0.821 | 2.43 | 0.457 | 0.649 | 0.243 | 0.359 | 0.157 | 0.075 | 1.205 |
Zambia | Sub-Saharan Africa | 4.073 | 0.069 | 4.209 | 3.938 | 8.145 | 0.708 | 55.809 | 0.782 | 0.061 | 0.823 | 2.43 | 0.528 | 0.552 | 0.231 | 0.487 | 0.227 | 0.074 | 1.975 |
Yemen | Middle East and North Africa | 3.658 | 0.070 | 3.794 | 3.521 | 7.578 | 0.832 | 57.122 | 0.602 | -0.147 | 0.800 | 2.43 | 0.329 | 0.831 | 0.272 | 0.268 | 0.092 | 0.089 | 1.776 |
Vietnam | Southeast Asia | 5.411 | 0.039 | 5.488 | 5.334 | 8.973 | 0.850 | 68.034 | 0.940 | -0.098 | 0.796 | 2.43 | 0.817 | 0.873 | 0.616 | 0.679 | 0.124 | 0.091 | 2.211 |
Venezuela | Latin America and Caribbean | 4.892 | 0.064 | 5.017 | 4.767 | 9.073 | 0.861 | 66.700 | 0.615 | -0.169 | 0.827 | 2.43 | 0.852 | 0.897 | 0.574 | 0.284 | 0.078 | 0.072 | 2.135 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
Armenia | Commonwealth of Independent States | 5.283 | 0.058 | 5.397 | 5.168 | 9.487 | 0.799 | 67.055 | 0.825 | -0.168 | 0.629 | 2.43 | 0.996 | 0.758 | 0.585 | 0.540 | 0.079 | 0.198 | 2.127 |
Argentina | Latin America and Caribbean | 5.929 | 0.056 | 6.040 | 5.819 | 9.962 | 0.898 | 69.000 | 0.828 | -0.182 | 0.834 | 2.43 | 1.162 | 0.980 | 0.646 | 0.544 | 0.069 | 0.067 | 2.461 |
Algeria | Middle East and North Africa | 4.887 | 0.053 | 4.991 | 4.783 | 9.342 | 0.802 | 66.005 | 0.480 | -0.067 | 0.752 | 2.43 | 0.946 | 0.765 | 0.552 | 0.119 | 0.144 | 0.120 | 2.242 |
Albania | Central and Eastern Europe | 5.117 | 0.059 | 5.234 | 5.001 | 9.520 | 0.697 | 68.999 | 0.785 | -0.030 | 0.901 | 2.43 | 1.008 | 0.529 | 0.646 | 0.491 | 0.168 | 0.024 | 2.250 |
Afghanistan | South Asia | 2.523 | 0.038 | 2.596 | 2.449 | 7.695 | 0.463 | 52.493 | 0.382 | -0.102 | 0.924 | 2.43 | 0.370 | 0.000 | 0.126 | 0.000 | 0.122 | 0.010 | 1.895 |
149 rows × 19 columns
In [40]:
titanic.sort_index(ascending=False)
Out[40]:
pclass | survived | name | sex | age | sibsp | parch | ticket | fare | cabin | embarked | boat | body | home.dest | |
1308 | 3 | 0 | Zimmerman, Mr. Leo | male | 29 | 0 | 0 | 315082 | 7.875 | ? | S | ? | ? | ? |
1307 | 3 | 0 | Zakarian, Mr. Ortin | male | 27 | 0 | 0 | 2670 | 7.225 | ? | C | ? | ? | ? |
1306 | 3 | 0 | Zakarian, Mr. Mapriededer | male | 26.5 | 0 | 0 | 2656 | 7.225 | ? | C | ? | 304 | ? |
1305 | 3 | 0 | Zabour, Miss. Thamine | female | ? | 1 | 0 | 2665 | 14.4542 | ? | C | ? | ? | ? |
1304 | 3 | 0 | Zabour, Miss. Hileni | female | 14.5 | 1 | 0 | 2665 | 14.4542 | ? | C | ? | 328 | ? |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
4 | 1 | 0 | Allison, Mrs. Hudson J C (Bessie Waldo Daniels) | female | 25 | 1 | 2 | 113781 | 151.55 | C22 C26 | S | ? | ? | Montreal, PQ / Chesterville, ON |
3 | 1 | 0 | Allison, Mr. Hudson Joshua Creighton | male | 30 | 1 | 2 | 113781 | 151.55 | C22 C26 | S | ? | 135 | Montreal, PQ / Chesterville, ON |
2 | 1 | 0 | Allison, Miss. Helen Loraine | female | 2 | 1 | 2 | 113781 | 151.55 | C22 C26 | S | ? | ? | Montreal, PQ / Chesterville, ON |
1 | 1 | 1 | Allison, Master. Hudson Trevor | male | 0.9167 | 1 | 2 | 113781 | 151.55 | C22 C26 | S | 11 | ? | Montreal, PQ / Chesterville, ON |
0 | 1 | 1 | Allen, Miss. Elisabeth Walton | female | 29 | 0 | 0 | 24160 | 211.3375 | B5 | S | 2 | ? | St Louis, MO |
1309 rows × 14 columns
In [41]:
titanic.pclass.value_counts().sort_values()
Out[41]:
2 277
1 323
3 709
Name: pclass, dtype: int64
In [42]:
titanic.pclass.value_counts().plot(kind="bar")
Out[42]:
<AxesSubplot:>

In [43]:
titanic.pclass.value_counts().sort_values().plot(kind="bar")
Out[43]:
<AxesSubplot:>

In [44]:
titanic.pclass.value_counts().sort_index().plot(kind="bar")
Out[44]:
<AxesSubplot:>

In [45]:
houses.bedrooms.value_counts().sort_values().plot(kind="bar")
Out[45]:
<AxesSubplot:>

In [46]:
houses.bedrooms.value_counts().sort_index().plot(kind="bar")
Out[46]:
<AxesSubplot:>

In [47]:
countries.head()
Out[47]:
Regional indicator | Ladder score | Standard error of ladder score | upperwhisker | lowerwhisker | Logged GDP per capita | Social support | Healthy life expectancy | Freedom to make life choices | Generosity | Perceptions of corruption | Ladder score in Dystopia | Explained by: Log GDP per capita | Explained by: Social support | Explained by: Healthy life expectancy | Explained by: Freedom to make life choices | Explained by: Generosity | Explained by: Perceptions of corruption | Dystopia + residual | |
Country name | |||||||||||||||||||
Zimbabwe | Sub-Saharan Africa | 3.145 | 0.058 | 3.259 | 3.030 | 7.943 | 0.750 | 56.201 | 0.677 | -0.047 | 0.821 | 2.43 | 0.457 | 0.649 | 0.243 | 0.359 | 0.157 | 0.075 | 1.205 |
Zambia | Sub-Saharan Africa | 4.073 | 0.069 | 4.209 | 3.938 | 8.145 | 0.708 | 55.809 | 0.782 | 0.061 | 0.823 | 2.43 | 0.528 | 0.552 | 0.231 | 0.487 | 0.227 | 0.074 | 1.975 |
Yemen | Middle East and North Africa | 3.658 | 0.070 | 3.794 | 3.521 | 7.578 | 0.832 | 57.122 | 0.602 | -0.147 | 0.800 | 2.43 | 0.329 | 0.831 | 0.272 | 0.268 | 0.092 | 0.089 | 1.776 |
Vietnam | Southeast Asia | 5.411 | 0.039 | 5.488 | 5.334 | 8.973 | 0.850 | 68.034 | 0.940 | -0.098 | 0.796 | 2.43 | 0.817 | 0.873 | 0.616 | 0.679 | 0.124 | 0.091 | 2.211 |
Venezuela | Latin America and Caribbean | 4.892 | 0.064 | 5.017 | 4.767 | 9.073 | 0.861 | 66.700 | 0.615 | -0.169 | 0.827 | 2.43 | 0.852 | 0.897 | 0.574 | 0.284 | 0.078 | 0.072 | 2.135 |
In [74]:
countries["Ladder score"]
Out[74]:
Country name
Afghanistan 2.523
Albania 5.117
Algeria 4.887
Argentina 5.929
Armenia 5.283
...
Venezuela 4.892
Vietnam 5.411
Yemen 3.658
Zambia 4.073
Zimbabwe 3.145
Name: Ladder score, Length: 149, dtype: float64
In [49]:
countries.loc["Yemen"]
Out[49]:
Regional indicator Middle East and North Africa
Ladder score 3.658
Standard error of ladder score 0.07
upperwhisker 3.794
lowerwhisker 3.521
Logged GDP per capita 7.578
Social support 0.832
Healthy life expectancy 57.122
Freedom to make life choices 0.602
Generosity -0.147
Perceptions of corruption 0.8
Ladder score in Dystopia 2.43
Explained by: Log GDP per capita 0.329
Explained by: Social support 0.831
Explained by: Healthy life expectancy 0.272
Explained by: Freedom to make life choices 0.268
Explained by: Generosity 0.092
Explained by: Perceptions of corruption 0.089
Dystopia + residual 1.776
Name: Yemen, dtype: object
In [50]:
countries.loc[["Yemen"]]
Out[50]:
Regional indicator | Ladder score | Standard error of ladder score | upperwhisker | lowerwhisker | Logged GDP per capita | Social support | Healthy life expectancy | Freedom to make life choices | Generosity | Perceptions of corruption | Ladder score in Dystopia | Explained by: Log GDP per capita | Explained by: Social support | Explained by: Healthy life expectancy | Explained by: Freedom to make life choices | Explained by: Generosity | Explained by: Perceptions of corruption | Dystopia + residual | |
Country name | |||||||||||||||||||
Yemen | Middle East and North Africa | 3.658 | 0.07 | 3.794 | 3.521 | 7.578 | 0.832 | 57.122 | 0.602 | -0.147 | 0.8 | 2.43 | 0.329 | 0.831 | 0.272 | 0.268 | 0.092 | 0.089 | 1.776 |
In [51]:
countries.loc[["Canada"]]
Out[51]:
Regional indicator | Ladder score | Standard error of ladder score | upperwhisker | lowerwhisker | Logged GDP per capita | Social support | Healthy life expectancy | Freedom to make life choices | Generosity | Perceptions of corruption | Ladder score in Dystopia | Explained by: Log GDP per capita | Explained by: Social support | Explained by: Healthy life expectancy | Explained by: Freedom to make life choices | Explained by: Generosity | Explained by: Perceptions of corruption | Dystopia + residual | |
Country name | |||||||||||||||||||
Canada | North America and ANZ | 7.103 | 0.042 | 7.185 | 7.021 | 10.776 | 0.926 | 73.8 | 0.915 | 0.089 | 0.415 | 2.43 | 1.447 | 1.044 | 0.798 | 0.648 | 0.246 | 0.335 | 2.585 |
In [52]:
countries.loc[["Canada", "Mexico", "United States"]]
Out[52]:
Regional indicator | Ladder score | Standard error of ladder score | upperwhisker | lowerwhisker | Logged GDP per capita | Social support | Healthy life expectancy | Freedom to make life choices | Generosity | Perceptions of corruption | Ladder score in Dystopia | Explained by: Log GDP per capita | Explained by: Social support | Explained by: Healthy life expectancy | Explained by: Freedom to make life choices | Explained by: Generosity | Explained by: Perceptions of corruption | Dystopia + residual | |
Country name | |||||||||||||||||||
Canada | North America and ANZ | 7.103 | 0.042 | 7.185 | 7.021 | 10.776 | 0.926 | 73.800 | 0.915 | 0.089 | 0.415 | 2.43 | 1.447 | 1.044 | 0.798 | 0.648 | 0.246 | 0.335 | 2.585 |
Mexico | Latin America and Caribbean | 6.317 | 0.053 | 6.420 | 6.213 | 9.859 | 0.831 | 68.597 | 0.862 | -0.147 | 0.799 | 2.43 | 1.126 | 0.830 | 0.634 | 0.585 | 0.092 | 0.089 | 2.961 |
United States | North America and ANZ | 6.951 | 0.049 | 7.047 | 6.856 | 11.023 | 0.920 | 68.200 | 0.837 | 0.098 | 0.698 | 2.43 | 1.533 | 1.030 | 0.621 | 0.554 | 0.252 | 0.154 | 2.807 |
In [53]:
titanic.loc[[7,9,876]]
Out[53]:
pclass | survived | name | sex | age | sibsp | parch | ticket | fare | cabin | embarked | boat | body | home.dest | |
7 | 1 | 0 | Andrews, Mr. Thomas Jr | male | 39 | 0 | 0 | 112050 | 0 | A36 | S | ? | ? | Belfast, NI |
9 | 1 | 0 | Artagaveytia, Mr. Ramon | male | 71 | 0 | 0 | PC 17609 | 49.5042 | ? | C | ? | 22 | Montevideo, Uruguay |
876 | 3 | 0 | Ilieff, Mr. Ylio | male | ? | 0 | 0 | 349220 | 7.8958 | ? | S | ? | ? | ? |
In [54]:
titanic.loc[5:10]
Out[54]:
pclass | survived | name | sex | age | sibsp | parch | ticket | fare | cabin | embarked | boat | body | home.dest | |
5 | 1 | 1 | Anderson, Mr. Harry | male | 48 | 0 | 0 | 19952 | 26.55 | E12 | S | 3 | ? | New York, NY |
6 | 1 | 1 | Andrews, Miss. Kornelia Theodosia | female | 63 | 1 | 0 | 13502 | 77.9583 | D7 | S | 10 | ? | Hudson, NY |
7 | 1 | 0 | Andrews, Mr. Thomas Jr | male | 39 | 0 | 0 | 112050 | 0 | A36 | S | ? | ? | Belfast, NI |
8 | 1 | 1 | Appleton, Mrs. Edward Dale (Charlotte Lamson) | female | 53 | 2 | 0 | 11769 | 51.4792 | C101 | S | D | ? | Bayside, Queens, NY |
9 | 1 | 0 | Artagaveytia, Mr. Ramon | male | 71 | 0 | 0 | PC 17609 | 49.5042 | ? | C | ? | 22 | Montevideo, Uruguay |
10 | 1 | 0 | Astor, Col. John Jacob | male | 47 | 1 | 0 | PC 17757 | 227.525 | C62 C64 | C | ? | 124 | New York, NY |
In [55]:
titanic.loc[5:10:2]
Out[55]:
pclass | survived | name | sex | age | sibsp | parch | ticket | fare | cabin | embarked | boat | body | home.dest | |
5 | 1 | 1 | Anderson, Mr. Harry | male | 48 | 0 | 0 | 19952 | 26.55 | E12 | S | 3 | ? | New York, NY |
7 | 1 | 0 | Andrews, Mr. Thomas Jr | male | 39 | 0 | 0 | 112050 | 0 | A36 | S | ? | ? | Belfast, NI |
9 | 1 | 0 | Artagaveytia, Mr. Ramon | male | 71 | 0 | 0 | PC 17609 | 49.5042 | ? | C | ? | 22 | Montevideo, Uruguay |
In [56]:
countries.sort_index(inplace=True)
In [57]:
countries
Out[57]:
Regional indicator | Ladder score | Standard error of ladder score | upperwhisker | lowerwhisker | Logged GDP per capita | Social support | Healthy life expectancy | Freedom to make life choices | Generosity | Perceptions of corruption | Ladder score in Dystopia | Explained by: Log GDP per capita | Explained by: Social support | Explained by: Healthy life expectancy | Explained by: Freedom to make life choices | Explained by: Generosity | Explained by: Perceptions of corruption | Dystopia + residual | |
Country name | |||||||||||||||||||
Afghanistan | South Asia | 2.523 | 0.038 | 2.596 | 2.449 | 7.695 | 0.463 | 52.493 | 0.382 | -0.102 | 0.924 | 2.43 | 0.370 | 0.000 | 0.126 | 0.000 | 0.122 | 0.010 | 1.895 |
Albania | Central and Eastern Europe | 5.117 | 0.059 | 5.234 | 5.001 | 9.520 | 0.697 | 68.999 | 0.785 | -0.030 | 0.901 | 2.43 | 1.008 | 0.529 | 0.646 | 0.491 | 0.168 | 0.024 | 2.250 |
Algeria | Middle East and North Africa | 4.887 | 0.053 | 4.991 | 4.783 | 9.342 | 0.802 | 66.005 | 0.480 | -0.067 | 0.752 | 2.43 | 0.946 | 0.765 | 0.552 | 0.119 | 0.144 | 0.120 | 2.242 |
Argentina | Latin America and Caribbean | 5.929 | 0.056 | 6.040 | 5.819 | 9.962 | 0.898 | 69.000 | 0.828 | -0.182 | 0.834 | 2.43 | 1.162 | 0.980 | 0.646 | 0.544 | 0.069 | 0.067 | 2.461 |
Armenia | Commonwealth of Independent States | 5.283 | 0.058 | 5.397 | 5.168 | 9.487 | 0.799 | 67.055 | 0.825 | -0.168 | 0.629 | 2.43 | 0.996 | 0.758 | 0.585 | 0.540 | 0.079 | 0.198 | 2.127 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
Venezuela | Latin America and Caribbean | 4.892 | 0.064 | 5.017 | 4.767 | 9.073 | 0.861 | 66.700 | 0.615 | -0.169 | 0.827 | 2.43 | 0.852 | 0.897 | 0.574 | 0.284 | 0.078 | 0.072 | 2.135 |
Vietnam | Southeast Asia | 5.411 | 0.039 | 5.488 | 5.334 | 8.973 | 0.850 | 68.034 | 0.940 | -0.098 | 0.796 | 2.43 | 0.817 | 0.873 | 0.616 | 0.679 | 0.124 | 0.091 | 2.211 |
Yemen | Middle East and North Africa | 3.658 | 0.070 | 3.794 | 3.521 | 7.578 | 0.832 | 57.122 | 0.602 | -0.147 | 0.800 | 2.43 | 0.329 | 0.831 | 0.272 | 0.268 | 0.092 | 0.089 | 1.776 |
Zambia | Sub-Saharan Africa | 4.073 | 0.069 | 4.209 | 3.938 | 8.145 | 0.708 | 55.809 | 0.782 | 0.061 | 0.823 | 2.43 | 0.528 | 0.552 | 0.231 | 0.487 | 0.227 | 0.074 | 1.975 |
Zimbabwe | Sub-Saharan Africa | 3.145 | 0.058 | 3.259 | 3.030 | 7.943 | 0.750 | 56.201 | 0.677 | -0.047 | 0.821 | 2.43 | 0.457 | 0.649 | 0.243 | 0.359 | 0.157 | 0.075 | 1.205 |
149 rows × 19 columns
In [58]:
countries.loc["Denmark":"France"]
Out[58]:
Regional indicator | Ladder score | Standard error of ladder score | upperwhisker | lowerwhisker | Logged GDP per capita | Social support | Healthy life expectancy | Freedom to make life choices | Generosity | Perceptions of corruption | Ladder score in Dystopia | Explained by: Log GDP per capita | Explained by: Social support | Explained by: Healthy life expectancy | Explained by: Freedom to make life choices | Explained by: Generosity | Explained by: Perceptions of corruption | Dystopia + residual | |
Country name | |||||||||||||||||||
Denmark | Western Europe | 7.620 | 0.035 | 7.687 | 7.552 | 10.933 | 0.954 | 72.700 | 0.946 | 0.030 | 0.179 | 2.43 | 1.502 | 1.108 | 0.763 | 0.686 | 0.208 | 0.485 | 2.868 |
Dominican Republic | Latin America and Caribbean | 5.545 | 0.071 | 5.685 | 5.405 | 9.802 | 0.853 | 66.102 | 0.860 | -0.133 | 0.714 | 2.43 | 1.106 | 0.879 | 0.555 | 0.581 | 0.101 | 0.144 | 2.178 |
Ecuador | Latin America and Caribbean | 5.764 | 0.057 | 5.875 | 5.653 | 9.313 | 0.821 | 68.800 | 0.842 | -0.124 | 0.843 | 2.43 | 0.935 | 0.806 | 0.640 | 0.560 | 0.107 | 0.062 | 2.653 |
Egypt | Middle East and North Africa | 4.283 | 0.045 | 4.371 | 4.195 | 9.367 | 0.750 | 61.998 | 0.749 | -0.182 | 0.795 | 2.43 | 0.954 | 0.647 | 0.426 | 0.446 | 0.069 | 0.092 | 1.648 |
El Salvador | Latin America and Caribbean | 6.061 | 0.065 | 6.188 | 5.933 | 9.054 | 0.762 | 66.402 | 0.888 | -0.110 | 0.688 | 2.43 | 0.845 | 0.675 | 0.565 | 0.615 | 0.116 | 0.160 | 3.085 |
Estonia | Central and Eastern Europe | 6.189 | 0.038 | 6.263 | 6.115 | 10.481 | 0.941 | 68.800 | 0.909 | -0.106 | 0.527 | 2.43 | 1.344 | 1.079 | 0.640 | 0.641 | 0.119 | 0.263 | 2.103 |
Ethiopia | Sub-Saharan Africa | 4.275 | 0.051 | 4.374 | 4.175 | 7.694 | 0.764 | 59.000 | 0.752 | 0.082 | 0.761 | 2.43 | 0.370 | 0.679 | 0.331 | 0.451 | 0.241 | 0.114 | 2.089 |
Finland | Western Europe | 7.842 | 0.032 | 7.904 | 7.780 | 10.775 | 0.954 | 72.000 | 0.949 | -0.098 | 0.186 | 2.43 | 1.446 | 1.106 | 0.741 | 0.691 | 0.124 | 0.481 | 3.253 |
France | Western Europe | 6.690 | 0.037 | 6.762 | 6.618 | 10.704 | 0.942 | 74.000 | 0.822 | -0.147 | 0.571 | 2.43 | 1.421 | 1.081 | 0.804 | 0.536 | 0.092 | 0.235 | 2.521 |
In [59]:
countries
Out[59]:
Regional indicator | Ladder score | Standard error of ladder score | upperwhisker | lowerwhisker | Logged GDP per capita | Social support | Healthy life expectancy | Freedom to make life choices | Generosity | Perceptions of corruption | Ladder score in Dystopia | Explained by: Log GDP per capita | Explained by: Social support | Explained by: Healthy life expectancy | Explained by: Freedom to make life choices | Explained by: Generosity | Explained by: Perceptions of corruption | Dystopia + residual | |
Country name | |||||||||||||||||||
Afghanistan | South Asia | 2.523 | 0.038 | 2.596 | 2.449 | 7.695 | 0.463 | 52.493 | 0.382 | -0.102 | 0.924 | 2.43 | 0.370 | 0.000 | 0.126 | 0.000 | 0.122 | 0.010 | 1.895 |
Albania | Central and Eastern Europe | 5.117 | 0.059 | 5.234 | 5.001 | 9.520 | 0.697 | 68.999 | 0.785 | -0.030 | 0.901 | 2.43 | 1.008 | 0.529 | 0.646 | 0.491 | 0.168 | 0.024 | 2.250 |
Algeria | Middle East and North Africa | 4.887 | 0.053 | 4.991 | 4.783 | 9.342 | 0.802 | 66.005 | 0.480 | -0.067 | 0.752 | 2.43 | 0.946 | 0.765 | 0.552 | 0.119 | 0.144 | 0.120 | 2.242 |
Argentina | Latin America and Caribbean | 5.929 | 0.056 | 6.040 | 5.819 | 9.962 | 0.898 | 69.000 | 0.828 | -0.182 | 0.834 | 2.43 | 1.162 | 0.980 | 0.646 | 0.544 | 0.069 | 0.067 | 2.461 |
Armenia | Commonwealth of Independent States | 5.283 | 0.058 | 5.397 | 5.168 | 9.487 | 0.799 | 67.055 | 0.825 | -0.168 | 0.629 | 2.43 | 0.996 | 0.758 | 0.585 | 0.540 | 0.079 | 0.198 | 2.127 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
Venezuela | Latin America and Caribbean | 4.892 | 0.064 | 5.017 | 4.767 | 9.073 | 0.861 | 66.700 | 0.615 | -0.169 | 0.827 | 2.43 | 0.852 | 0.897 | 0.574 | 0.284 | 0.078 | 0.072 | 2.135 |
Vietnam | Southeast Asia | 5.411 | 0.039 | 5.488 | 5.334 | 8.973 | 0.850 | 68.034 | 0.940 | -0.098 | 0.796 | 2.43 | 0.817 | 0.873 | 0.616 | 0.679 | 0.124 | 0.091 | 2.211 |
Yemen | Middle East and North Africa | 3.658 | 0.070 | 3.794 | 3.521 | 7.578 | 0.832 | 57.122 | 0.602 | -0.147 | 0.800 | 2.43 | 0.329 | 0.831 | 0.272 | 0.268 | 0.092 | 0.089 | 1.776 |
Zambia | Sub-Saharan Africa | 4.073 | 0.069 | 4.209 | 3.938 | 8.145 | 0.708 | 55.809 | 0.782 | 0.061 | 0.823 | 2.43 | 0.528 | 0.552 | 0.231 | 0.487 | 0.227 | 0.074 | 1.975 |
Zimbabwe | Sub-Saharan Africa | 3.145 | 0.058 | 3.259 | 3.030 | 7.943 | 0.750 | 56.201 | 0.677 | -0.047 | 0.821 | 2.43 | 0.457 | 0.649 | 0.243 | 0.359 | 0.157 | 0.075 | 1.205 |
149 rows × 19 columns
In [60]:
countries.iloc[[0]]
Out[60]:
Regional indicator | Ladder score | Standard error of ladder score | upperwhisker | lowerwhisker | Logged GDP per capita | Social support | Healthy life expectancy | Freedom to make life choices | Generosity | Perceptions of corruption | Ladder score in Dystopia | Explained by: Log GDP per capita | Explained by: Social support | Explained by: Healthy life expectancy | Explained by: Freedom to make life choices | Explained by: Generosity | Explained by: Perceptions of corruption | Dystopia + residual | |
Country name | |||||||||||||||||||
Afghanistan | South Asia | 2.523 | 0.038 | 2.596 | 2.449 | 7.695 | 0.463 | 52.493 | 0.382 | -0.102 | 0.924 | 2.43 | 0.37 | 0.0 | 0.126 | 0.0 | 0.122 | 0.01 | 1.895 |
In [61]:
countries.iloc[[10,20,30,100]]
Out[61]:
Regional indicator | Ladder score | Standard error of ladder score | upperwhisker | lowerwhisker | Logged GDP per capita | Social support | Healthy life expectancy | Freedom to make life choices | Generosity | Perceptions of corruption | Ladder score in Dystopia | Explained by: Log GDP per capita | Explained by: Social support | Explained by: Healthy life expectancy | Explained by: Freedom to make life choices | Explained by: Generosity | Explained by: Perceptions of corruption | Dystopia + residual | |
Country name | |||||||||||||||||||
Belarus | Commonwealth of Independent States | 5.534 | 0.047 | 5.625 | 5.442 | 9.853 | 0.910 | 66.253 | 0.650 | -0.180 | 0.627 | 2.43 | 1.124 | 1.007 | 0.560 | 0.326 | 0.070 | 0.199 | 2.247 |
Cambodia | Southeast Asia | 4.830 | 0.067 | 4.963 | 4.698 | 8.360 | 0.765 | 62.000 | 0.959 | 0.034 | 0.843 | 2.43 | 0.603 | 0.680 | 0.426 | 0.702 | 0.210 | 0.061 | 2.148 |
Croatia | Central and Eastern Europe | 5.882 | 0.048 | 5.975 | 5.788 | 10.217 | 0.924 | 70.799 | 0.754 | -0.118 | 0.939 | 2.43 | 1.251 | 1.039 | 0.703 | 0.453 | 0.111 | 0.000 | 2.325 |
Nigeria | Sub-Saharan Africa | 4.759 | 0.052 | 4.861 | 4.658 | 8.533 | 0.740 | 50.102 | 0.737 | 0.037 | 0.878 | 2.43 | 0.663 | 0.625 | 0.051 | 0.433 | 0.212 | 0.039 | 2.736 |
In [62]:
countries.iloc[50:60]
Out[62]:
Regional indicator | Ladder score | Standard error of ladder score | upperwhisker | lowerwhisker | Logged GDP per capita | Social support | Healthy life expectancy | Freedom to make life choices | Generosity | Perceptions of corruption | Ladder score in Dystopia | Explained by: Log GDP per capita | Explained by: Social support | Explained by: Healthy life expectancy | Explained by: Freedom to make life choices | Explained by: Generosity | Explained by: Perceptions of corruption | Dystopia + residual | |
Country name | |||||||||||||||||||
Haiti | Latin America and Caribbean | 3.615 | 0.173 | 3.953 | 3.276 | 7.477 | 0.540 | 55.700 | 0.593 | 0.422 | 0.721 | 2.43 | 0.294 | 0.173 | 0.227 | 0.257 | 0.463 | 0.139 | 2.060 |
Honduras | Latin America and Caribbean | 5.919 | 0.082 | 6.081 | 5.758 | 8.648 | 0.812 | 67.300 | 0.857 | 0.081 | 0.809 | 2.43 | 0.703 | 0.787 | 0.593 | 0.578 | 0.241 | 0.083 | 2.934 |
Hong Kong S.A.R. of China | East Asia | 5.477 | 0.049 | 5.573 | 5.380 | 11.000 | 0.836 | 76.820 | 0.717 | 0.067 | 0.403 | 2.43 | 1.525 | 0.841 | 0.893 | 0.408 | 0.232 | 0.342 | 1.236 |
Hungary | Central and Eastern Europe | 5.992 | 0.047 | 6.085 | 5.899 | 10.358 | 0.943 | 68.000 | 0.755 | -0.186 | 0.876 | 2.43 | 1.301 | 1.083 | 0.615 | 0.454 | 0.067 | 0.040 | 2.432 |
Iceland | Western Europe | 7.554 | 0.059 | 7.670 | 7.438 | 10.878 | 0.983 | 73.000 | 0.955 | 0.160 | 0.673 | 2.43 | 1.482 | 1.172 | 0.772 | 0.698 | 0.293 | 0.170 | 2.967 |
India | South Asia | 3.819 | 0.026 | 3.869 | 3.769 | 8.755 | 0.603 | 60.633 | 0.893 | 0.089 | 0.774 | 2.43 | 0.741 | 0.316 | 0.383 | 0.622 | 0.246 | 0.106 | 1.405 |
Indonesia | Southeast Asia | 5.345 | 0.056 | 5.454 | 5.235 | 9.365 | 0.811 | 62.236 | 0.873 | 0.542 | 0.867 | 2.43 | 0.954 | 0.786 | 0.433 | 0.598 | 0.541 | 0.046 | 1.987 |
Iran | Middle East and North Africa | 4.721 | 0.055 | 4.828 | 4.614 | 9.584 | 0.710 | 66.300 | 0.608 | 0.218 | 0.714 | 2.43 | 1.030 | 0.557 | 0.561 | 0.275 | 0.330 | 0.144 | 1.823 |
Iraq | Middle East and North Africa | 4.854 | 0.059 | 4.970 | 4.738 | 9.240 | 0.746 | 60.583 | 0.630 | -0.053 | 0.875 | 2.43 | 0.910 | 0.638 | 0.381 | 0.302 | 0.153 | 0.041 | 2.429 |
Ireland | Western Europe | 7.085 | 0.040 | 7.164 | 7.006 | 11.342 | 0.947 | 72.400 | 0.879 | 0.077 | 0.363 | 2.43 | 1.644 | 1.092 | 0.753 | 0.606 | 0.238 | 0.367 | 2.384 |
In [63]:
houses.sort_index(ascending=False, inplace=True)
In [64]:
houses
Out[64]:
id | date | price | bedrooms | bathrooms | sqft_living | sqft_lot | floors | waterfront | view | ... | grade | sqft_above | sqft_basement | yr_built | yr_renovated | zipcode | lat | long | sqft_living15 | sqft_lot15 | |
21612 | 1523300157 | 20141015T000000 | 325000.0 | 2 | 0.75 | 1020 | 1076 | 2.0 | 0 | 0 | ... | 7 | 1020 | 0 | 2008 | 0 | 98144 | 47.5941 | -122.299 | 1020 | 1357 |
21611 | 291310100 | 20150116T000000 | 400000.0 | 3 | 2.50 | 1600 | 2388 | 2.0 | 0 | 0 | ... | 8 | 1600 | 0 | 2004 | 0 | 98027 | 47.5345 | -122.069 | 1410 | 1287 |
21610 | 1523300141 | 20140623T000000 | 402101.0 | 2 | 0.75 | 1020 | 1350 | 2.0 | 0 | 0 | ... | 7 | 1020 | 0 | 2009 | 0 | 98144 | 47.5944 | -122.299 | 1020 | 2007 |
21609 | 6600060120 | 20150223T000000 | 400000.0 | 4 | 2.50 | 2310 | 5813 | 2.0 | 0 | 0 | ... | 8 | 2310 | 0 | 2014 | 0 | 98146 | 47.5107 | -122.362 | 1830 | 7200 |
21608 | 263000018 | 20140521T000000 | 360000.0 | 3 | 2.50 | 1530 | 1131 | 3.0 | 0 | 0 | ... | 8 | 1530 | 0 | 2009 | 0 | 98103 | 47.6993 | -122.346 | 1530 | 1509 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
4 | 1954400510 | 20150218T000000 | 510000.0 | 3 | 2.00 | 1680 | 8080 | 1.0 | 0 | 0 | ... | 8 | 1680 | 0 | 1987 | 0 | 98074 | 47.6168 | -122.045 | 1800 | 7503 |
3 | 2487200875 | 20141209T000000 | 604000.0 | 4 | 3.00 | 1960 | 5000 | 1.0 | 0 | 0 | ... | 7 | 1050 | 910 | 1965 | 0 | 98136 | 47.5208 | -122.393 | 1360 | 5000 |
2 | 5631500400 | 20150225T000000 | 180000.0 | 2 | 1.00 | 770 | 10000 | 1.0 | 0 | 0 | ... | 6 | 770 | 0 | 1933 | 0 | 98028 | 47.7379 | -122.233 | 2720 | 8062 |
1 | 6414100192 | 20141209T000000 | 538000.0 | 3 | 2.25 | 2570 | 7242 | 2.0 | 0 | 0 | ... | 7 | 2170 | 400 | 1951 | 1991 | 98125 | 47.7210 | -122.319 | 1690 | 7639 |
0 | 7129300520 | 20141013T000000 | 221900.0 | 3 | 1.00 | 1180 | 5650 | 1.0 | 0 | 0 | ... | 7 | 1180 | 0 | 1955 | 0 | 98178 | 47.5112 | -122.257 | 1340 | 5650 |
21613 rows × 21 columns
In [65]:
houses.iloc[0:5]
Out[65]:
id | date | price | bedrooms | bathrooms | sqft_living | sqft_lot | floors | waterfront | view | ... | grade | sqft_above | sqft_basement | yr_built | yr_renovated | zipcode | lat | long | sqft_living15 | sqft_lot15 | |
21612 | 1523300157 | 20141015T000000 | 325000.0 | 2 | 0.75 | 1020 | 1076 | 2.0 | 0 | 0 | ... | 7 | 1020 | 0 | 2008 | 0 | 98144 | 47.5941 | -122.299 | 1020 | 1357 |
21611 | 291310100 | 20150116T000000 | 400000.0 | 3 | 2.50 | 1600 | 2388 | 2.0 | 0 | 0 | ... | 8 | 1600 | 0 | 2004 | 0 | 98027 | 47.5345 | -122.069 | 1410 | 1287 |
21610 | 1523300141 | 20140623T000000 | 402101.0 | 2 | 0.75 | 1020 | 1350 | 2.0 | 0 | 0 | ... | 7 | 1020 | 0 | 2009 | 0 | 98144 | 47.5944 | -122.299 | 1020 | 2007 |
21609 | 6600060120 | 20150223T000000 | 400000.0 | 4 | 2.50 | 2310 | 5813 | 2.0 | 0 | 0 | ... | 8 | 2310 | 0 | 2014 | 0 | 98146 | 47.5107 | -122.362 | 1830 | 7200 |
21608 | 263000018 | 20140521T000000 | 360000.0 | 3 | 2.50 | 1530 | 1131 | 3.0 | 0 | 0 | ... | 8 | 1530 | 0 | 2009 | 0 | 98103 | 47.6993 | -122.346 | 1530 | 1509 |
5 rows × 21 columns
In [66]:
houses.loc[21612:21611]
Out[66]:
id | date | price | bedrooms | bathrooms | sqft_living | sqft_lot | floors | waterfront | view | ... | grade | sqft_above | sqft_basement | yr_built | yr_renovated | zipcode | lat | long | sqft_living15 | sqft_lot15 | |
21612 | 1523300157 | 20141015T000000 | 325000.0 | 2 | 0.75 | 1020 | 1076 | 2.0 | 0 | 0 | ... | 7 | 1020 | 0 | 2008 | 0 | 98144 | 47.5941 | -122.299 | 1020 | 1357 |
21611 | 291310100 | 20150116T000000 | 400000.0 | 3 | 2.50 | 1600 | 2388 | 2.0 | 0 | 0 | ... | 8 | 1600 | 0 | 2004 | 0 | 98027 | 47.5345 | -122.069 | 1410 | 1287 |
2 rows × 21 columns
In [67]:
houses.loc[21612:21611, ['price', 'bedrooms']]
Out[67]:
price | bedrooms | |
21612 | 325000.0 | 2 |
21611 | 400000.0 | 3 |
In [68]:
titanic.loc[50:60:2, ['name', 'sex', 'age']]
Out[68]:
name | sex | age | |
50 | Cardeza, Mrs. James Warburton Martinez (Charlo... | female | 58 |
52 | Carrau, Mr. Francisco M | male | 28 |
54 | Carter, Master. William Thornton II | male | 11 |
56 | Carter, Mr. William Ernest | male | 36 |
58 | Case, Mr. Howard Brown | male | 49 |
60 | Cavendish, Mr. Tyrell William | male | 36 |
In [69]:
countries.loc["Canada": "Denmark", ['Ladder score']]
Out[69]:
Ladder score | |
Country name | |
Canada | 7.103 |
Chad | 4.355 |
Chile | 6.172 |
China | 5.339 |
Colombia | 6.012 |
Comoros | 4.289 |
Congo (Brazzaville) | 5.342 |
Costa Rica | 7.069 |
Croatia | 5.882 |
Cyprus | 6.223 |
Czech Republic | 6.965 |
Denmark | 7.620 |
In [70]:
houses["bedrooms"].value_counts().loc[33]
Out[70]:
1
In [71]:
titanic["age"].value_counts().loc["18"]
Out[71]:
39
In [72]:
titanic["age"].value_counts().iloc[0:5]
Out[72]:
? 263
24 47
22 43
21 41
30 40
Name: age, dtype: int64